diff options
Diffstat (limited to 'Xamarin.Forms.Xaml')
-rw-r--r-- | Xamarin.Forms.Xaml/XmlnsHelper.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml/XmlnsHelper.cs b/Xamarin.Forms.Xaml/XmlnsHelper.cs index e29dbc0c..5f7efd48 100644 --- a/Xamarin.Forms.Xaml/XmlnsHelper.cs +++ b/Xamarin.Forms.Xaml/XmlnsHelper.cs @@ -20,6 +20,19 @@ namespace Xamarin.Forms.Xaml { typeName = ns = asm = targetPlatform = null; + xmlns = xmlns.Trim(); + + if (xmlns.StartsWith("using:", StringComparison.Ordinal)) { + ParseUsing(xmlns, out typeName, out ns, out asm, out targetPlatform); + return; + } + ParseClrNamespace(xmlns, out typeName, out ns, out asm, out targetPlatform); + } + + static void ParseClrNamespace(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform) + { + typeName = ns = asm = targetPlatform = null; + foreach (var decl in xmlns.Split(';')) { if (decl.StartsWith("clr-namespace:", StringComparison.Ordinal)) @@ -46,5 +59,17 @@ namespace Xamarin.Forms.Xaml typeName = decl; } } + + static void ParseUsing(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform) + { + typeName = ns = asm = targetPlatform = null; + + foreach (var decl in xmlns.Split(';')) { + if (decl.StartsWith("using:", StringComparison.Ordinal)) { + ns = decl.Substring(6, decl.Length - 6); + continue; + } + } + } } }
\ No newline at end of file |