How to databind ActiveWindow

Docking/MDI for WPF Forum

Posted 5 years ago by Jim Carole
Version: 14.2.0611
Avatar

When user clicks on a tab, I want to update my ViewModel's ActiveWindow property. When I update my ViewModel's ActiveWindow property, I want that tab to be activated. But DockSite's ActiveWindow property is read-only. So what property of a DockSite do I databind to accomplish this?

Comments (6)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Jim,

I don't think there is a property you can set via binding, but you can call the window's Activate() method when you want to activate it programmatically.


Actipro Software Support

Posted 5 years ago by Jim Carole
Avatar

I'm using MVVM so binding is important for keeping views and models in sync. Without a bindable ActiveWindow property in DocSite, I had to write an attached property and handle model > view sync (in which I do call Activate). To handle the other direction I guess I'll have to handle an event. Which event fires when ActiveWindow property changes?

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Jim,

The DockSite.WindowActivated event fires when the ActiveWindow property changes.


Actipro Software Support

Posted 5 years ago by Jim Carole
Avatar

Thanks. The atttached property I wrote is working in both directions now.

Howver...making DockSite.ActiveWindow bindable will save your users 60 lines of code, though.

Posted 5 years ago by Justin Klein
Avatar

+1 to Jim's request; it would be nuch nicer if ActiveWindow were bindable...

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi all,

In Docking/MDI vNext (still in development), we have added a DockingWindow.IsActive property that is bindable and is get/set.  You can set that to true to make the window become the ActiveWindow.  See this blog post for details:

http://blog.actiprosoftware.com/post/2015/08/24/DockingMDI-vNext-MVVM-Property-Improvements


Actipro Software Support

The latest build of this product (v2019.1 build 0685) was released 13 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.