How to loop through controls in a DocumentWindow?

Docking/MDI for WPF Forum

Posted 8 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 8 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 (v2018.1 build 0675) 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.