Hi i have few a single textbox within the the datatemplate for itemscontrol. When i bind the itemcontrols to a observable collection i get two text boxes. But i need to do s
Thanks Bryce, I tried to tick the up arrow but it says my rating is too low! Sorry!
I amended the code to return all a list of all the children of the given type as it was what I needed and thought someone else might find it useful.
Thanks again Bryce, really helpful - sorry about the rating thing!
public static List FindVisualChildren(DependencyObject depObj) where T : DependencyObject
{
List list = new List();
if (depObj != null)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
if (child != null && child is T)
{
list.Add((T)child);
}
List childItems = FindVisualChildren(child);
if (childItems != null && childItems.Count() > 0)
{
foreach (var item in childItems)
{
list.Add(item);
}
}
}
}
return list;
}