Example #1
0
		public void GetAliasedProperty ()
		{
			XamlMember xm;
			var xt = new XamlType (typeof (SeverlyAliasedClass), new XamlSchemaContext (null, null));
			xm = xt.GetAliasedProperty (XamlLanguage.Key);
			Assert.IsNotNull (xm, "#1");
			xm = xt.GetAliasedProperty (XamlLanguage.Name);
			Assert.IsNotNull (xm, "#2");
			xm = xt.GetAliasedProperty (XamlLanguage.Uid);
			Assert.IsNotNull (xm, "#3");
			xm = xt.GetAliasedProperty (XamlLanguage.Lang);
			Assert.IsNotNull (xm, "#4");
			
			xt = new XamlType (typeof (Dictionary<int,string>), xt.SchemaContext);
			Assert.IsNull (xt.GetAliasedProperty (XamlLanguage.Key), "#5");
		}
 private bool IsDirectiveAllowedOnNullInstance(XamlMember xamlMember, XamlType xamlType)
 {
     return ((xamlMember == XamlLanguage.Key) || ((xamlMember == XamlLanguage.Uid) && (null == xamlType.GetAliasedProperty(XamlLanguage.Uid))));
 }
Example #3
0
 internal static bool IsNameProperty(XamlMember member, XamlType owner)
 {
     if (member == owner.GetAliasedProperty(XamlLanguage.Name)
          || XamlLanguage.Name == member)
     {
         return true;
     }
     return false;
 }
 private object GetKeyFromInstance(object instance, XamlType instanceType, IAddLineInfo lineInfo)
 {
     XamlMember aliasedProperty = instanceType.GetAliasedProperty(XamlLanguage.Key);
     if ((aliasedProperty == null) || (instance == null))
     {
         throw lineInfo.WithLineInfo(new XamlObjectWriterException(System.Xaml.SR.Get("MissingKey", new object[] { instanceType.Name })));
     }
     return this.Runtime.GetValue(instance, aliasedProperty);
 }
 public void Initialize(XamlParserContext context, XamlType tagType, string ownerNamespace, bool tagIsRoot)
 {
     if (this.Kind != ScannerAttributeKind.Namespace)
     {
         this.Property = this.GetXamlAttributeProperty(context, this.Name, tagType, ownerNamespace, tagIsRoot);
         if (this.Property.IsUnknown)
         {
             this.Kind = ScannerAttributeKind.Unknown;
         }
         else if (this.Property.IsEvent)
         {
             this.Kind = ScannerAttributeKind.Event;
         }
         else if (this.Property.IsDirective)
         {
             if (this.Property == XamlLanguage.Space)
             {
                 this.Kind = ScannerAttributeKind.XmlSpace;
             }
             else if (((this.Property == XamlLanguage.FactoryMethod) || (this.Property == XamlLanguage.Arguments)) || ((this.Property == XamlLanguage.TypeArguments) || (this.Property == XamlLanguage.Base)))
             {
                 this.Kind = ScannerAttributeKind.CtorDirective;
             }
             else
             {
                 this.Kind = ScannerAttributeKind.Directive;
             }
         }
         else if (this.Property.IsAttachable)
         {
             this.Kind = ScannerAttributeKind.AttachableProperty;
         }
         else if (this.Property == tagType.GetAliasedProperty(XamlLanguage.Name))
         {
             this.Kind = ScannerAttributeKind.Name;
         }
         else
         {
             this.Kind = ScannerAttributeKind.Property;
         }
     }
 }