jssblck
jssblck

Reputation: 529

Programmatic Navigation in MVVM Single Window Application

I'm quite new to WPF and MVVM programming, but I am trying to create a WPF app using MVVM as a single-window application.

I followed the steps here: https://rachel53461.wordpress.com/2011/12/18/navigation-with-mvvm-2/ and was able to adapt the examples given for my project. However, I want to programmatically activate the views; how can I do this?

Thanks for any help!

Upvotes: 2

Views: 292

Answers (1)

tinku92
tinku92

Reputation: 109

Ok, First I checked the example in the blogpost. I admit it's one way to do things, but I feel TabControl does the same thing albeit in an easy way. If the number of items in your TabControl is static you can find the solution here. WPF MVVM: Binding a different ViewModel to each TabItem?

If it's dynamic TabControl you are after you can check out the example here. http://www.c-sharpcorner.com/Blogs/15488/dynamic-tab-control-in-wpf-mvvm.aspx

if you don't understand any of the examples give me a shout and I will try to help.

Edit 1

And also TabControl has many properties that will help you do things DockPanel can't.

Upvotes: 1

Related Questions