Rise from your grave.....
I've just had this problem and it's actually not too bad. Both the Title Links - the little ones like Settings in the top of the frame - and the actual Menu are dependency properties and can be bound in your Viewmodel.
Here's how I declare mine -
private LinkGroupCollection _menuLinkGroups = new LinkGroupCollection();
public LinkGroupCollection MenuLinkGroups
{
get => _menuLinkGroups;
set => SetProperty(ref _menuLinkGroups, value);
}
private LinkCollection _titleLinks = new LinkCollection();
public LinkCollection TitleLinks
{
get => _titleLinks;
set => SetProperty(ref _titleLinks, value);
}
Then I can populate them like so -
private void ConstructLinks()
{
if (MenuLinkGroups.Any())
{
MenuLinkGroups.Clear();
TitleLinks.Clear();
}
var group = new LinkGroup {DisplayName = "Home"};
var link = new Link { DisplayName = "Home", Source = MenuLinks.Home };
group.Links.Add(link);
MenuLinkGroups.Add(group);
group = new LinkGroup{DisplayName = "Menu 1"};
link = new Link {DisplayName = "Menu Item 1", Source = MenuLinks.Item1};
group.Links.Add(link);
link = new Link {DisplayName = "Menu Item 2", Source = MenuLinks.Item2};
group.Links.Add(link);
MenuLinkGroups.Add(group);
group = new LinkGroup { DisplayName = "Menu 2" };
link = new Link { DisplayName = "Menu Item3", Source = MenuLinks.Item3 };
group.Links.Add(link);
link = new Link {DisplayName = "Menu Item 4", Source = MenuLinks.Item4};
group.Links.Add(link);
MenuLinkGroups.Add(group);
// Settings
link = new Link { DisplayName = "Settings", Source = MenuLinks.Settings };
TitleLinks.Add(link);
}
The MenuLinks class is just a static class containing the various URIs to my Views.
And finally bind them in the XAML.
<mui:ModernWindow x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
Title="{Binding Title}" IsTitleVisible="True"
ContentSource="/Views/Introduction.xaml"
Width="800" Height="700" WindowState="Maximized" SizeToContent="Manual"
TitleLinks ="{Binding TitleLinks}"
MenuLinkGroups ="{Binding MenuLinkGroups}">
</mui:ModernWindow>
It's worth pointing out that ContentSource is also a Dependency Property so you can bind that, too. If you fancy a little ghetto navigation, that is.