Hi Im writing a WPF application that has user login. I use Modern UI for this application. The application has following LinkGroups:
<mui:ModernWindow.MenuLinkGroups>
<mui:LinkGroup DisplayName="Group 1">
<mui:LinkGroup.Links>
<mui:Link DisplayName="A" Source="/Pages/A.xaml" />
<mui:Link DisplayName="B" Source="/Pages/B.xaml" />
<mui:Link DisplayName="C" Source="/Pages/C.xaml" />
</mui:LinkGroup.Links>
</mui:LinkGroup>
<mui:LinkGroup DisplayName="Group 2">
<mui:LinkGroup.Links>
<mui:Link DisplayName="D" Source="/Pages/D.xaml" />
<mui:Link DisplayName="F" Source="/Pages/F.xaml" />
<mui:Link DisplayName="G" Source="/Pages/G.xaml" />
</mui:LinkGroup.Links>
</mui:LinkGroup>
</mui:ModernWindow.MenuLinkGroups>
I want to hide or disable Link group named "Group 2" depending on user ID. Is there a way to do it?
Maybe it is too late, but I think that had a solution. Since
LinkGroup
is not derived fromUIElement
it is not possible to hide it, but you can work around this. I'm sure that it isn't the clearest solution, but it worked for me.You can reach your
LinkGroup
s viaMenuLinkGroups
is aCollection<T>
thus you canAdd
andRemove
items.