4 using System.Collections.Generic;
7 using System.Windows.Documents;
8 using System.Windows.Media;
10 namespace SiliconStudio.Presentation.Extensions
16 return FindAdornableOfType<Visual>(source);
19 public static T FindAdornableOfType<T>(
this Visual source) where T : Visual
22 throw new ArgumentNullException(
"source");
24 if (AdornerLayer.GetAdornerLayer(source) != null && source is T)
27 int childCount = VisualTreeHelper.GetChildrenCount(source);
28 for (
int i = 0; i < childCount; i++)
30 var child = VisualTreeHelper.GetChild(source, i) as T;
33 var test = child.FindAdornableOfType<T>();
45 throw new ArgumentNullException(
"source");
47 var adornerLayer = AdornerLayer.GetAdornerLayer(source);
48 if (adornerLayer != null)
51 int childCount = VisualTreeHelper.GetChildrenCount(source);
52 for (
int i = 0; i < childCount; i++)
54 var child = VisualTreeHelper.GetChild(source, i) as Visual;
57 var test = child.FindAdornerLayer();
static AdornerLayer FindAdornerLayer(this Visual source)
static Visual FindAdornable(this Visual source)