Posts
Recursive ContainerFromItem
if (dp != null) return dp; foreach (var item in itemsControl.Items) { var currentTreeViewItem = itemsControl.ItemContainerGenerator.ContainerFromItem(item); var childDp = ContainerFromItem(currentTreeViewItem as ItemsControl, value); if (childDp != null) return childDp; } return null; }</pre> public static class ItemsControlExtension { public static DependencyObject ContainerFromItem(this ItemsControl itemsControl, object value) { var dp = itemsControl.ItemContainerGenerator.ContainerFromItem(value);
if (dp != null) return dp; foreach (var item in itemsControl.Items) { var currentTreeViewItem = itemsControl.ItemContainerGenerator.ContainerFromItem(item); var childDp = ContainerFromItem(currentTreeViewItem as ItemsControl, value); if (childDp !
read more