Click here to Skip to main content
15,911,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am new to WPF+MVM , a have one main view and inside it i have two child views .One child view has 2 buttons and the other child view has a tab strip having two tabs.On the click of a button in one child view how to shift tabs in the other view? i know it would be simple but i have wasted a lot of time googling for it.
Posted

1 solution

What I'd do is to have some property for the button/tab state in the View Model for the main view and provide reference to the main View Model into the View Models for the child views. The child View Models can re-expose the property which is data bound in the child views.

For a bit better encapsulation, you could have a small class which holds the button/tab state in a property and have the main View Model create an instance of that class and provide the reference to that into the child View Models.

In any case, the class containing the button/tab state property should implement INotifyPropertyChanged so that the views track changes in the state value.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900