I'm working with LonglistSector, and i got problem like this guy, link: Why does WP8 LongListSelector incorrectly re-use Checked state of CheckBox?. I read Dennis's answer, i understand problem, but i dont known how to did it, i try using VisualTreeHelper for get checkbox checked, my code example:
private string SearchVisualTree(DependencyObject targetElement)
{
var count = VisualTreeHelper.GetChildrenCount(targetElement);
for (int i = 0; i < count; i++)
{
var child = VisualTreeHelper.GetChild(targetElement, i);
if (child is CheckBox)
{
CheckBox targetItem = (CheckBox)child;
if (targetItem.IsChecked == true && targetItem.IsPressed==true)
{
result = targetItem.Tag.ToString();
break;
}
}
else
{
SearchVisualTree(child);
}
}
return result;
}
I got the result:
idBH = SearchVisualTree(Longlistsector);
I got the Checkbox.Tag, but other checkbox still checked ! How can I fix this, need help.....
Aucun commentaire:
Enregistrer un commentaire