summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs')
-rw-r--r--Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs b/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
index eb040e02..f94f3d62 100644
--- a/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
+++ b/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
@@ -128,5 +128,21 @@ namespace Xamarin.Forms.Platform.WinRT
return foregroundProperty;
}
+
+ internal static IEnumerable<T> GetChildren<T>(this DependencyObject parent) where T : DependencyObject
+ {
+ int myChildrenCount = VisualTreeHelper.GetChildrenCount(parent);
+ for (int i = 0; i < myChildrenCount; i++)
+ {
+ var child = VisualTreeHelper.GetChild(parent, i);
+ if (child is T)
+ yield return child as T;
+ else
+ {
+ foreach (var subChild in child.GetChildren<T>())
+ yield return subChild;
+ }
+ }
+ }
}
} \ No newline at end of file