This project is read-only.

Why isn't IsActive a Dependency Property?

Jun 13, 2012 at 10:49 PM
Edited Jun 13, 2012 at 11:03 PM

I would like to bind the IsActive property to a property in the ViewModel.

That way my ViewModel can have a "CurrentActivity" concept that can control which tab is visible.

But IsActive is not a Dependency Property.  So I am stuck.

Is there another way for my ViewModel to bind to which tab is currently focused?  I saw IsSelected, but it is not a Dependency Property either. (Side question: What is the difference between IsSelected and IsActive).  I also tried SelectedContentIndex on LayoutDocumentPane (no luck).

It almost seems as if these properties are deliberately blocked.  So I am left wondering if there is a "Recommended Way" to do this.  But I have checked the samples and the documentation and can't seem to find a way to do this.

(A simple use case would be to have a command (in a Ribbon or Menu for example) cause a tab to get focused.

I tried this in a non MVVM style and it works. So if I am willing to use code behind, then I can just say MyCurrentTab.IsActive=true.  But I am writing an MVVM app and would rather not have to do that.

So, how can my ViewModel control what Tab is currently "active"?

Jun 13, 2012 at 11:18 PM

If you look at the MVVMTestApp you should see how to use the LayoutItemContainerStyle/StyleSelector. Then just bind the IsSelected and IsActive to your model properties. IsSelected is true if the tab is selected inside its container pane. IsActive is instead true if the LayoutAnchorable/LayoutDocument is the active content among all contents managed from the DockingManager. There can be only one active content.


Jun 14, 2012 at 6:31 PM


Thanks for pointing me in the right direction.

By the way, the Selector system you have going on is really fantastic.