2

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!

jssblck
  • 529
  • 5
  • 20

1 Answers1

1

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.

Community
  • 1
  • 1
tinku92
  • 109
  • 7
  • Thanks for the input! Unfortunately I'll have to wait until tomorrow to check this, but if I can remove the tabs from view this will probably solve my issue. – jssblck Jul 09 '15 at 05:06