/// <summary> /// Add "Bring To Front" and "Send To Back" menu entries into the given menu. /// </summary> /// <param name="menu"></param> /// <param name="element"></param> protected void AddZOrderMenuItems(MenuBase menu, ShapeViewModelBase element) { try { if (element != null) { MenuItem submenu = new MenuItem() { Header = "Z-Order" }; menu.Items.Add(submenu); submenu.Items.Add(new MenuItem() { Header = MiniUML.Framework.Local.Strings.STR_MENUITEM_BringToFront, Command = element.BringToFront, Icon = IconImageFactory.Get(IconCommand.SendToBack) }); submenu.Items.Add(new MenuItem() { Header = MiniUML.Framework.Local.Strings.STR_MENUITEM_SendToBack, Command = element.SendToBack, Icon = IconImageFactory.Get(IconCommand.BringToFront) }); } } catch { } }
/// <summary> /// Add standard application Cut, Copy, Paste, and Deleete menu entries. /// </summary> /// <param name="menu"></param> protected void AddCopyCutPasteMenuItems(MenuBase menu) { menu.Items.Add(new MenuItem() { Command = ApplicationCommands.Cut, Icon = IconImageFactory.Get(IconCommand.Cut) }); menu.Items.Add(new MenuItem() { Command = ApplicationCommands.Copy, Icon = IconImageFactory.Get(IconCommand.Copy) }); menu.Items.Add(new MenuItem() { Command = ApplicationCommands.Paste, Icon = IconImageFactory.Get(IconCommand.Paste) }); menu.Items.Add(new MenuItem() { Command = ApplicationCommands.Delete, Icon = IconImageFactory.Get(IconCommand.Delete) }); }
/// <summary> /// Construct commands, bindings, and menu items for shape alignment functions. /// (Align Top, Align Center etc). /// </summary> /// <param name="menu"></param> /// <param name="element"></param> protected void SameSizeMenuItems(MenuBase menu, ShapeSizeViewModelBase element) { try { if (element != null) { MenuItem submenu = new MenuItem() { Header = "Same Size" }; menu.Items.Add(submenu); submenu.Items.Add(new MenuItem() { Header = "Same Width", Command = element.AdjustShapesToSameSize, CommandParameter = SameSize.SameWidth, Icon = IconImageFactory.Get(IconCommand.AlignObjectsLeft) }); submenu.Items.Add(new MenuItem() { Header = "Same Height", Command = element.AdjustShapesToSameSize, CommandParameter = SameSize.SameHeight, Icon = IconImageFactory.Get(IconCommand.AlignObjectsTop) }); submenu.Items.Add(new MenuItem() { Header = "Same Width and Height", Command = element.AdjustShapesToSameSize, CommandParameter = SameSize.SameWidthandHeight, Icon = IconImageFactory.Get(IconCommand.AlignObjectsRight) }); } } catch { } }
/// <summary> /// Construct commands, bindings, and menu items for shape alignment functions. /// (Align Top, Align Center etc). /// </summary> /// <param name="menu"></param> /// <param name="element"></param> protected void AlignMenuItems(MenuBase menu, ShapeSizeViewModelBase element) { try { if (element != null) { MenuItem submenu = new MenuItem() { Header = "Align" }; menu.Items.Add(submenu); submenu.Items.Add(new MenuItem() { Header = "Align Objects Left", Command = element.AlignShapes, CommandParameter = AlignShapes.Left, Icon = IconImageFactory.Get(IconCommand.AlignObjectsLeft) }); submenu.Items.Add(new MenuItem() { Header = "Align Objects Top", Command = element.AlignShapes, CommandParameter = AlignShapes.Top, Icon = IconImageFactory.Get(IconCommand.AlignObjectsTop) }); submenu.Items.Add(new MenuItem() { Header = "Align Objects Right", Command = element.AlignShapes, CommandParameter = AlignShapes.Right, Icon = IconImageFactory.Get(IconCommand.AlignObjectsRight) }); submenu.Items.Add(new MenuItem() { Header = "Align Objects Bottom", Command = element.AlignShapes, CommandParameter = AlignShapes.Bottom, Icon = IconImageFactory.Get(IconCommand.AlignObjectsBottom) }); submenu.Items.Add(new Separator()); submenu.Items.Add(new MenuItem() { Header = "Align Objects Centered Horizontal", Command = element.AlignShapes, CommandParameter = AlignShapes.CenteredHorizontal, Icon = IconImageFactory.Get(IconCommand.AlignObjectsCenteredHorizontal) }); submenu.Items.Add(new MenuItem() { Header = "Align Objects Centered Vertical", Command = element.AlignShapes, CommandParameter = AlignShapes.CenteredVertical, Icon = IconImageFactory.Get(IconCommand.AlignObjectsCenteredVertical) }); } } catch { } }