Exemplo n.º 1
0
        private void lbCategories_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_showWIndow)
            {
                OrderAdd orderAdd = new OrderAdd((ProductCategories)e.AddedItems[0], _order, _OrderDetailOptionList, _OrderDetailAdonList);
                orderAdd.ShowDialog();

                _showWIndow = false;
                if (UserOrder != null && UserOrder.OrderDetailsList != null)
                {
                    OrderNow.Visibility     = System.Windows.Visibility.Visible;
                    OrderDetail.ItemsSource = null;
                    //OrderDetail.DataContext = UserOrder.OrderDetailsList;
                    OrderDetail.ItemsSource = UserOrder.OrderDetailsList;
                    OrderDetail.Items.Refresh();
                    OrderTotal.Content = "$" + UserOrder.OrderTotal;
                }
                else
                {
                    OrderNow.Visibility     = System.Windows.Visibility.Hidden;
                    OrderDetail.DataContext = null;
                    OrderDetail.UpdateLayout();
                }
            }
        }
Exemplo n.º 2
0
        private void Button_TouchEnter(object sender, TouchEventArgs e)
        {
            Button button = sender as Button;
            //walk up the tree to find the ListboxItem
            DependencyObject tvi = findParentTreeItem(button, typeof(ListBoxItem));

            //if not null cast the Dependancy object to type of Listbox item.
            if (tvi != null)
            {
                ListBoxItem lbi      = tvi as ListBoxItem;
                OrderAdd    orderAdd = new OrderAdd((ProductCategories)((System.Windows.Controls.ContentControl)(lbi)).Content, _order, _OrderDetailOptionList, _OrderDetailAdonList);

                orderAdd.ShowDialog();
                orderAdd.Dispose();
                _showWIndow = false;
                if (UserOrder != null && UserOrder.OrderDetailsList != null)
                {
                    OrderNow.Visibility     = System.Windows.Visibility.Visible;
                    OrderDetail.ItemsSource = null;
                    //OrderDetail.DataContext = UserOrder.OrderDetailsList;
                    OrderDetail.ItemsSource = UserOrder.OrderDetailsList;
                    OrderDetail.Items.Refresh();
                    OrderTotal.Content = "$" + UserOrder.OrderTotal;
                }
                else
                {
                    OrderNow.Visibility     = System.Windows.Visibility.Hidden;
                    OrderDetail.DataContext = null;
                    OrderDetail.UpdateLayout();
                }
            }
        }