Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

MVVM. how to build and display a Menu at runtime

$
0
0

hi,

I must build a customized menu and display on the left side of a XAML Window. The result should be the following

each menu item information (labels, icons) is retrieved from DB; anymore, each menu item has submenus attached to it.

The menu shown in picture is built at runtime, in the code-behind of the Window. More exactly, I built 5 menus, giving each of them a position and putting into the main Grid using Grid.Children.add command.

Now, I wish to move the code to build menu in a WindowViewModel file of the ViewModel layer, and bind it to a public property (called Menu). But I dont know how to bind the Menu property in order to display it in the Window. Of course, I cannot use Grid.Children.add statement. Anyone can help me to find the way?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>