How do the Tab Pages of the ModernTab get the ViewModel of the ParentView?

Nov 7, 2013 at 2:37 PM
I'm using Moder UI for my application and it's a great platform.

I have a main view (PageMain) and the main view has a ModernTab which has 2 tabs (PageTab1, PageTab2). How can PageTab1 and PageTab2 get the ViewModel used by PageMain?

My implementation now is to define an instance of my ViewModel as a member of My.Application so it can be referred from anywhere by "My.Application.MyViewModel. But I'm not sure if this is a good way to implement it.

Thanks in advance.
Nov 8, 2013 at 11:45 AM
Can't you set the DataContext for the ModernTab control to the PageMain's viewmodel? IIRC, all the children of the ModernTab control will inherit the parent's DataContext.
Nov 8, 2013 at 4:03 PM
ccbVT wrote:
Can't you set the DataContext for the ModernTab control to the PageMain's viewmodel? IIRC, all the children of the ModernTab control will inherit the parent's DataContext.
Thank you ccbVT. You are right, all children of the ModernTab control do inherit the parents DataContext. So I actually don't need set Context for PageTab1 and PageTab2.