How to set focus on newly added document

Docking/MDI for WPF Forum

Posted 11 years ago by Rick Turbeville
Version: 12.2.0570
Avatar

Hi,

Somewhat new to this so if somebody could point me in the right direction I would appreciate it.

I'm using MVVM along with a TabbedMdiHost and using a DeferableObservableCollection to hold the documents (this.documentItems)

I can successfully add a new document programmatically by adding it to the documentItems collection (this.documentItems.Add(xxxxx)

My question is how do I then set focus to that new document window? I have looked high and low and I'm sure it's simple.

Right now it adds the tab but the focus stays on the current document.

Thanks!

Rick

Comments (1)

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

Hi Rick,

You can use the DockSite.ContainerFromItem method to get a docking window for an item.  Then just call Activate() on that to make sure its tab is visible/selected, and the content gets focused.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.