Skip to content

How can I use NavigationBar with MVVM? (MaterialDesign3) #3833

Answered by corvinsz
BrensNina asked this question in Q&A
Discussion options

You must be logged in to vote

"Navigation" in WPF can implemented in many different ways.

In the MD3 demo Navigation is not implemented on a Button click/RelayCommand.
For each view/page a DemoItem is created, and each DemoItem consists of multiple different properties, e.g.:

  • Name
  • Icon
  • Content (An instance of a UserControl)

etc..

The MainWindowViewModel holds a List/ObservableCollection of those DemoItems. This List is displayed (via the ListBox) on the left, as you already mentioned. On the right side is a ContentControl which is bound to the Content of the SelectedItem of the ListBox.
So essentially the "only" thing that is happening is, that the Content of the said ContentControl is switched, whenever the Selecte…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BrensNina
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants