Class MenuItemViewModel
View model for a menu item.
public class MenuItemViewModel : NotificationObject, INotifyPropertyChanged
- Inheritance
-
NotificationObjectMenuItemViewModel
- Implements
- Derived
- Inherited Members
-
NotificationObject.PropertyChanged
Properties
Command
Gets or sets the menu item command.
public ICommand Command { get; set; }
Property Value
Header
Gets or sets the header text.
public string Header { get; set; }
Property Value
IsChecked
Gets or sets whether the menu item should be checked.
public bool IsChecked { get; set; }
Property Value
IsSeparator
Gets or sets whether this represents a separator.
public bool IsSeparator { get; set; }
Property Value
IsSubmenuOpen
Gets or sets whether this menu's submenu is open.
public bool IsSubmenuOpen { get; set; }
Property Value
IsVisible
Gets or sets whether the menu item should be visible.
public bool IsVisible { get; set; }
Property Value
Items
Gets the collection of child items.
public ObservableCollection<MenuItemViewModel> Items { get; }
Property Value
SortHint
Gets or sets the sort hint.
public string SortHint { get; set; }
Property Value
Remarks
Items with SortHint values that are not null or empty will appear first, ordered in ascending order by their SortHint values, as a simple ordinal comparison (i.e., via CompareOrdinal(string, string). Then items with null or empty SortHint values will appear, in the order in which they were added.
This is only used as items are added via the AddChildItem(MenuItemViewModel) and AddChildItems(IEnumerable<MenuItemViewModel>) methods. Changing this value later will not cause the menu item to change sort position.
Methods
AddChildItem(MenuItemViewModel)
Adds the specified menu item, honoring its sort hint.
public void AddChildItem(MenuItemViewModel item)
Parameters
item
MenuItemViewModelThe item to add.
Exceptions
- ArgumentNullException
item
is null.
AddChildItems(IEnumerable<MenuItemViewModel>)
Adds the specified menu items, honoring their sort hints as they are added.
public void AddChildItems(IEnumerable<MenuItemViewModel> items)
Parameters
items
IEnumerable<MenuItemViewModel>The items to add.
Exceptions
- ArgumentNullException
items
is null.
Events
SubmenuOpened
Occurs when this menu's submenu opened.
public event EventHandler SubmenuOpened