DocumentWindow - Accesing the current selected properties

Docking/MDI for WPF Forum

Posted 14 years ago by Bret Naughton
Version: 10.1.0521
Avatar
Hi,

I am using VB to dynamically create documentWindows for a TabbedMDIContainer each time I want to display a new tab. This works fine and I have set the .Title of the documentWindow accordingly.

I have also used the TabbedMdiHost.PrimaryWindowChangedEvent to detect when I change the tab focus and I can successfully display a message whenever a tab is selected.

What I would like to do is to access the properties of the documentWindow of the selected tab (so I can change the main window title; etc.)

Know it must be simple, but having trouble getting the syntax right for determining the active documentWindow to access the relevant .title/.filename/.description - seem to be going in circles at the moment. Have searched the sample for example but no luck.

Would be grateful if somebody has an example of how I can do this.

Thanks
Bret

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

There isn't a single "selected" document window, since you can have several groups of documents docked side-by-side. The PrimiaryWindow is used to indicate the last selected/active document and is probably your best bet to use for syncing the title bar. If you already have a handler for PrimaryWindowChanged, then you can check the NewValue in the event arguments. That will be the new primary DockingWindow.

You can get the Title and Description from the DockingWindow, but you will have to try to cast it to a DocumentWindow (i.e. DocumentWindow documentWindow = e.NewValue as DocumentWindow) to get a FileName. Keep in mind that ToolWindows can be docked in the MDI area and become the primary window, so you cannot assume it will always be a DocumentWindow.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.