private void IconView_ViewRightClicked(object sender, IconViewRightClickedEventArgs e) { if (showingMenu) { showingMenu = false; return; } FrameworkElement thisControl = (FrameworkElement)sender; thisControl.ContextMenu = new ContextMenu(); MenuItem addIngredient = new MenuItem(); addIngredient.Header = "Add Ingredient"; addIngredient.Click += AddIngredient_Click; thisControl.ContextMenu.Items.Add(addIngredient); thisControl.ContextMenu.IsOpen = true; }
private void IconView_ViewRightClicked(object sender, IconViewRightClickedEventArgs e) { if (showingMenu) { showingMenu = false; return; } FrameworkElement thisControl = (FrameworkElement)sender; VariationModel model = new VariationModel(parent); if (model.HasChildren && model.Children[0] is VariationModel) { MenuItem addVariation = new MenuItem(); addVariation.Header = "Add Variation"; addVariation.Click += AddVariation_Click; thisControl.ContextMenu = new ContextMenu(); thisControl.ContextMenu.Items.Add(addVariation); thisControl.ContextMenu.IsOpen = true; } }