I am working with a team on LoB application. We would like to have a dynamic Menu control, which creates the menu based on the logged in user profile. In previo
This solution doesn't need any code in code behind and that makes it simpler solution.
And MenuItem is represented as:
public class MenuItemViewModel : BaseViewModel
{
///
/// Initializes a new instance of the class.
///
/// The parent view model.
public MenuItemViewModel(MenuItemViewModel parentViewModel)
{
ParentViewModel = parentViewModel;
_childMenuItems = new ObservableCollection();
}
private ObservableCollection _childMenuItems;
///
/// Gets the child menu items.
///
/// The child menu items.
public ObservableCollection ChildMenuItems
{
get
{
return _childMenuItems;
}
}
private string _header;
///
/// Gets or sets the header.
///
/// The header.
public string Header
{
get
{
return _header;
}
set
{
_header = value; NotifyOnPropertyChanged("Header");
}
}
///
/// Gets or sets the parent view model.
///
/// The parent view model.
public MenuItemViewModel ParentViewModel { get; set; }
public virtual void LoadChildMenuItems()
{
}
}
The concrete MenuItems can be either instantiated directly or you could make your own SubTypes through inheritance.