Use this function to list all children of type ComboBox belonging to the data grid :
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
{
if (depObj != null)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
if (child != null && child is T)
{
yield return (T)child;
}
foreach (T childOfChild in FindVisualChildren<T>(child))
{
yield return childOfChild;
}
}
}
}
After you get all the combo boxes to distinguish the desired one from the others check their
DataContext
property. It should refer to the data item which belongs to the row that you know. (use
break point and
quick watch features to find out to which object
DataContext
refers).
Hope it helps.