当前位置: 首页>>代码示例>>C#>>正文


C# XamlType.GetXamlNamespaces方法代码示例

本文整理汇总了C#中XamlType.GetXamlNamespaces方法的典型用法代码示例。如果您正苦于以下问题:C# XamlType.GetXamlNamespaces方法的具体用法?C# XamlType.GetXamlNamespaces怎么用?C# XamlType.GetXamlNamespaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XamlType的用法示例。


在下文中一共展示了XamlType.GetXamlNamespaces方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LookupPrefix

 private string LookupPrefix(XamlType type)
 {
     string str;
     string prefix = this.xamlXmlWriter.LookupPrefix(type.GetXamlNamespaces(), out str);
     if ((prefix == null) && !this.meSettings.ContinueWritingWhenPrefixIsNotFound)
     {
         this.failed = true;
         return string.Empty;
     }
     return prefix;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:XamlMarkupExtensionWriter.cs

示例2: XamlTypeName

 public XamlTypeName(XamlType xamlType)
 {
     if (xamlType == null)
     {
         throw new ArgumentNullException("xamlType");
     }
     this.Name = xamlType.Name;
     this.Namespace = xamlType.GetXamlNamespaces()[0];
     if (xamlType.TypeArguments != null)
     {
         foreach (XamlType type in xamlType.TypeArguments)
         {
             this.TypeArguments.Add(new XamlTypeName(type));
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:XamlTypeName.cs

示例3: GetXamlNamespaces

		public void GetXamlNamespaces ()
		{
			var xt = new XamlType (typeof (string), new XamlSchemaContext (null, null));
			var l = xt.GetXamlNamespaces ().ToList ();
			l.Sort ();
			Assert.AreEqual (2, l.Count, "#1-1");
			Assert.AreEqual ("clr-namespace:System;assembly=mscorlib", l [0], "#1-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, l [1], "#1-3");

			xt = new XamlType (typeof (TypeExtension), new XamlSchemaContext (null, null));
			l = xt.GetXamlNamespaces ().ToList ();
			l.Sort ();
			Assert.AreEqual (3, l.Count, "#2-1");
			Assert.AreEqual ("clr-namespace:System.Windows.Markup;assembly=System.Xaml", l [0], "#2-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, l [1], "#2-3");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, l [2], "#2-4"); // ??
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:17,代码来源:XamlTypeTest.cs

示例4: Logic_GetFullyQualifiedNameForType

        private string Logic_GetFullyQualifiedNameForType(XamlType type) 
        {
            Baml2006ReaderFrame currentFrame = _context.CurrentFrame; 
 
            IList<string> xamlNamespaces = type.GetXamlNamespaces();
 
            while (currentFrame != null)
            {
                foreach(string xmlns in xamlNamespaces)
                { 
                    string prefix = null;
 
                    if (currentFrame.TryGetPrefixByNamespace(xmlns, out prefix)) 
                    {
                        if (String.IsNullOrEmpty(prefix)) 
                        {
                            return type.Name;
                        }
                        else 
                        {
                            return prefix + ":" + type.Name; 
                        } 
                    }
                } 

                currentFrame = (Baml2006ReaderFrame)currentFrame.Previous;
            }
 
            throw new InvalidOperationException("Could not find prefix for type: " + type.Name);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:30,代码来源:Baml2006Reader.cs

示例5: GetXamlNamespaces

		public void GetXamlNamespaces ()
		{
			var xt = new XamlType (typeof (string), new XamlSchemaContext (null, null));
			var l = xt.GetXamlNamespaces ().ToList ();
			l.Sort ();
			Assert.AreEqual (2, l.Count, "#1-1");
			Assert.AreEqual ("clr-namespace:System;assembly=mscorlib", l [0], "#1-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, l [1], "#1-3");

			xt = new XamlType (typeof (TypeExtension), new XamlSchemaContext (null, null));
			l = xt.GetXamlNamespaces ().ToList ();
			l.Sort ();
			Assert.AreEqual (3, l.Count, "#2-1");
			Assert.AreEqual ("clr-namespace:Portable.Xaml.Markup;assembly=Portable.Xaml".Fixup(), l [0], "#2-2");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, l [1], "#2-3");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, l [2], "#2-4"); // ??

			xt = new XamlType (typeof (List<string>), new XamlSchemaContext (null, null));
			l = xt.GetXamlNamespaces ().ToList ();
			l.Sort ();
			Assert.AreEqual (1, l.Count, "#3-1");
			Assert.AreEqual ("clr-namespace:System.Collections.Generic;assembly=mscorlib", l [0], "#3-2");
		}
开发者ID:cwensley,项目名称:Portable.Xaml,代码行数:23,代码来源:XamlTypeTest.cs

示例6: PropertyTypeMatchesGenericTagType

 private bool PropertyTypeMatchesGenericTagType(XamlType tagType, string tagNs, string propNs, string propTypeName)
 {
     if (((tagNs != propNs) && (tagType.Name != propTypeName)) && !tagType.GetXamlNamespaces().Contains(propNs))
     {
         return false;
     }
     XamlType type = this.GetXamlType(propNs, propTypeName, tagType.TypeArguments);
     return (tagType == type);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:XamlContext.cs

示例7: GetNoDotAttributeProperty

 public XamlMember GetNoDotAttributeProperty(XamlType tagType, XamlPropertyName propName, string tagNamespace, string propUsageNamespace, bool tagIsRoot)
 {
     XamlMember xamlAttachableProperty = null;
     if ((propUsageNamespace == tagNamespace) || (((tagNamespace == null) && (propUsageNamespace != null)) && tagType.GetXamlNamespaces().Contains(propUsageNamespace)))
     {
         XamlType rootObjectType = tagIsRoot ? tagType : null;
         xamlAttachableProperty = this.GetXamlProperty(tagType, propName.Name, rootObjectType);
         if (xamlAttachableProperty == null)
         {
             xamlAttachableProperty = this.GetXamlAttachableProperty(tagType, propName.Name);
         }
     }
     if ((xamlAttachableProperty == null) && (propUsageNamespace != null))
     {
         XamlDirective xamlDirective = this.SchemaContext.GetXamlDirective(propUsageNamespace, propName.Name);
         if (xamlDirective != null)
         {
             if ((xamlDirective.AllowedLocation & AllowedMemberLocations.Attribute) == AllowedMemberLocations.None)
             {
                 xamlDirective = new XamlDirective(propUsageNamespace, propName.Name);
             }
             xamlAttachableProperty = xamlDirective;
         }
     }
     if (xamlAttachableProperty != null)
     {
         return xamlAttachableProperty;
     }
     if (tagNamespace == propUsageNamespace)
     {
         return new XamlMember(propName.Name, tagType, false);
     }
     return new XamlDirective(propUsageNamespace, propName.Name);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:XamlContext.cs

示例8: IsXClassName

        bool IsXClassName(XamlType xamlType)
        {
            if (xamlType == null || this.xClassName == null || xamlType.Name != this.xClassName.Name)
            {
                return false;
            }

            // this code is kept for back compatible
            string preferredNamespace = xamlType.PreferredXamlNamespace;
            if (preferredNamespace.Contains(clrNamespacePart))
            {
                return IsXClassName(preferredNamespace);
            }

            // GetXamlNamespaces is a superset of PreferredXamlNamespace, it's not a must for the above code
            // to check for preferredXamlNamespace, but since the old code uses .Contains(), which was a minor 

            IList<string> namespaces = xamlType.GetXamlNamespaces();
            foreach (string ns in namespaces)
            {
                if (ns.StartsWith(clrNamespacePart, StringComparison.Ordinal))
                {
                    return IsXClassName(ns);
                }
            }

            return false;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:28,代码来源:DynamicActivityXamlReader.cs

示例9: GetXamlNamespaces

		public void GetXamlNamespaces ()
		{
			var xt = new XamlType (typeof (string), new XamlSchemaContext (null, null));
			var l = xt.GetXamlNamespaces ();
			Assert.AreEqual (2, l.Count, "#1");
			Assert.AreEqual (XamlLanguage.Xaml2006Namespace, l [0], "#2");
			Assert.AreEqual ("clr-namespace:System;assembly=mscorlib", l [1], "#3");
		}
开发者ID:stabbylambda,项目名称:mono,代码行数:8,代码来源:XamlTypeTest.cs


注:本文中的XamlType.GetXamlNamespaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。