In the above XAML code, I am getting children (of ItemsCotnrol x:Name="PointsList) using below code and getting the count = 0. Can you help me to fix this issue.
int count = VisualTreeHelper.GetChildrenCount(pointsList);
if (count > 0)
{
for (int i = 0; i < count; i++)
{
UIElement child = VisualTreeHelper.GetChild(pointsList, i) as UIElement;
if (child.GetType() == typeof(TextBlock))
{
textPoints = child as TextBlock;
break;
}
}
}
pointsList is defined as follows.
pointsList = (ItemsControl)GetTemplateChild("PointsList");