Replies: 3 comments
-
You can disable the built-in Settings item (property on NavView) and supply your own in the FooterMenuItems/FooterMenuItemsSource. |
Beta Was this translation helpful? Give feedback.
-
That's a nice workaround for the settings case, but how to define templates? I haven't managed to bind my own model's name and icon to the NavigationViewMenuItems. I've looked for a pure MVVM sample, but found nothing. |
Beta Was this translation helpful? Give feedback.
-
I'm assuming you have different ViewModel types for different types of items? To handle that, use a DataTemplateSelector, which there is an example for on the NavigationView page: and the DataTemplateSelector class impl: (note in the sample app I put that class with the ViewModel, but that's just because I'm lazy - that can be put anywhere). This is a minimal version of the DataTemplateSelector. It could be made more extensible by storing a list of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
In order to follow the MVVM pattern, you need to avoid having references to anything that is related to the underlying presentation technology in a ViewModel. This control makes it very difficult to follow that requirement, because for example, the Settings item is a UI control.
I've rather go with all models instead.
Beta Was this translation helpful? Give feedback.
All reactions