Reputation: 11
How to get the Elements defined under Control Template in runtime in WPF
Upvotes: 1
Views: 603
Reputation: 132568
You could probably use the VisualTreeHelper to find children. For example:
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parentElement); i++)
{
var childElement = VisualTreeHelper.GetChild(parentElement, i);
// Do something with object here
}
Upvotes: 2
Reputation: 21863
use the Template Properties FindName method
Control.Template.FindName
Upvotes: 2