Have some free time and wanted to try making a game in WPF. I was wondering, what is the best way of changing the view of a window? I have made a \"main menu\" window, with
It is appropriate to use DataTemplates if you want to dynamically switch Views depending on the ViewModel:
If Window.DataContext
is an instance of ViewModelA
, then ViewA
will be displayed and
Window.DataContext
is an instance of ViewModelB, then ViewB will be displayed.
The best example I've ever seen and read it is made by Rachel Lim. See the example.