I need to access a grid in a list-view data-template, but when using this code the program reaches the foreach loop and don't execute it
foreach (Grid firstgrid in Active_list.Items)
{
var item = Active_list.ItemContainerGenerator.ContainerFromItem(firstgrid);
var ch = AllChildren(item);
var tag = url;
var control = (Grid)ch.First(c => c.Tag == tag);
if (firstgrid.GetType() == typeof(Grid))
{
if ((String)firstgrid.Tag == url)
{
foreach (ProgressBar prg in firstgrid.Children)
{
if (prg.GetType() == typeof(ProgressBar))
{
prg.IsIndeterminate = false;
}
}
foreach (TextBlock txt in firstgrid.Children)
{
if (txt.GetType() == typeof(TextBlock))
{
txt.Visibility = Visibility.Visible;
}
}
}
}
}