How to loop through controls in a DocumentWindow?

Docking/MDI for WPF Forum

Posted 9 years ago by ryan phelps
Version: 11.1.0542
Avatar

Hi,

I've been trying to do something fairly simple (I thouight). Basically I want to loop through all the controls that are within a DocumentWindow. I thought the C# code would be something like:

// testDocumentWindow, DocumentWindow containing other controls

foreach (object obj in testDocumentWindow.Items)
{
//do something
}

There are no attributes for testDocumentWindow.Controls, testDocumentWindow.Children or testDocumentWindow.Items.

Could someone please help.

Thanks,

Ryan.

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ryan,

The DocumentWindow is a ContentControl, so it will effectively only have 1 child element. You can use VisualTreeHelper and our VisualTreeHelperExtended to walk the visual tree to get any descendents/children.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.