summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-07-18 23:33:41 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-07-18 23:33:41 (GMT)
commita490740a2e76b9c53735d9778d4c6e0fa9e4bf22 (patch)
tree58c90dbb2c378412ceed70679eac6c33045954b9 /Xamarin.Forms.Platform.WinRT
parentbe9f626c37949cc56c5f6901dac93093f3016fbf (diff)
downloadxamarin-forms-a490740a2e76b9c53735d9778d4c6e0fa9e4bf22.zip
xamarin-forms-a490740a2e76b9c53735d9778d4c6e0fa9e4bf22.tar.gz
xamarin-forms-a490740a2e76b9c53735d9778d4c6e0fa9e4bf22.tar.bz2
[Win] Setting TabbedPage.BarTextColor works (#244)
[Win] TabbedPage BarBG takes precedence
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
-rw-r--r--Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs b/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
index 64b2daa..eb040e0 100644
--- a/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
+++ b/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs
@@ -1,4 +1,5 @@
´╗┐using System;
+using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Windows.UI.Xaml;
@@ -71,6 +72,23 @@ namespace Xamarin.Forms.Platform.WinRT
element.SetBinding(GetForegroundProperty(element), binding);
}
+ internal static IEnumerable<T> GetDescendantsByName<T>(this DependencyObject parent, string elementName) where T : DependencyObject
+ {
+ int myChildrenCount = VisualTreeHelper.GetChildrenCount(parent);
+ for (int i = 0; i < myChildrenCount; i++)
+ {
+ var child = VisualTreeHelper.GetChild(parent, i);
+ var controlName = child.GetValue(FrameworkElement.NameProperty) as string;
+ if (controlName == elementName && child is T)
+ yield return child as T;
+ else
+ {
+ foreach (var subChild in child.GetDescendantsByName<T>(elementName))
+ yield return subChild;
+ }
+ }
+ }
+
internal static T GetFirstDescendant<T>(this DependencyObject element) where T : FrameworkElement
{
int count = VisualTreeHelper.GetChildrenCount(element);