Beispiel #1
0
 public void NewOptionsMenu(MenuObject newItem)
 {
     editingOldOrder = false;
     item            = newItem;
     NewOptionsMenu();
 }
        private void MenuItemListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                //toggleOptions(false);


                /*Style style = new Style();
                 * style.TargetType = typeof(ListViewItem);
                 * style.Setters.Add(new Setter(ListViewItem.BackgroundProperty, Brushes.Pink));
                 * style.
                 * menuItemListView.ItemContainerStyle = style;*/


                MenuObject menuItem = (MenuObject)this.menuItemListView.SelectedItem;

                foreach (MenuObject element in menuItemListView.Items)
                {
                    element.collapseOptions();
                }

                if (menuItem.OptionsExpander.IsExpanded)
                {
                    menuItem.collapseOptions();
                }
                else
                {
                    menuItem.expandOptions();
                }

                int verticalOffset = 0;
                var temp           = menuItemListView.SelectedIndex;

                if (menuItem.type == MenuObject.Type.Main)
                {
                    verticalOffset = menuItemListView.SelectedIndex * 222 + 90;
                }
                else if (menuItem.type == MenuObject.Type.Side)
                {
                    verticalOffset = menuItemListView.SelectedIndex * 222 + (90 * 2);
                }
                else if (menuItem.type == MenuObject.Type.Dessert)
                {
                    verticalOffset = menuItemListView.SelectedIndex * 222 + (90 * 3);
                }
                else
                {
                    verticalOffset = menuItemListView.SelectedIndex * 222 + (90 * 4);
                }


                //verticalOffset -= 615;

                /* menuItem.Transf
                 * Point relativePOint = menuItem.TransformToAncestor(menuItemScrollViewer).Transform(new Point(0, 0));*/

                //menuItem.optionsMenu.NewOptionsMenu();

                menuItem.optionsMenu.makeSureRadiosAreChecked();

                Thread.Sleep(300);
                menuItemScrollViewer.ScrollToVerticalOffset(verticalOffset);



                e.Handled = true;
                //OptionsPopUp.NewOptionsMenu(menuItem);
            }
            catch (Exception error)
            {
                System.Diagnostics.Debug.WriteLine(error);
            }
        }