本文整理汇总了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;
}
示例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));
}
}
}
示例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"); // ??
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
示例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;
}
示例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");
}