private XamlPropertySetter LookupReflectionProperty(IXamlNode reader) { XamlPropertySetter prop = XamlReflectionPropertyForName(Type, reader.LocalName); if (prop != null) { return(prop); } object target = Object; MutableObject obj = Object as MutableObject; if (obj != null) { target = obj.Object; } XamlPropertySetter evnt = XamlReflectionEventForName(target, reader.LocalName); if (evnt != null) { return(evnt); } XamlPropertySetter attached = XamlImplicitAttachedPropertyForName(target, reader.LocalName); if (attached != null) { return(attached); } return(null); }
public override XamlPropertySetter LookupProperty(IXamlNode reader) { if (IsNameProperty(reader)) { return(new XamlNamePropertySetter(this, (DependencyObject)Object)); } XamlPropertySetter prop = LookupAttachedProperty(reader); if (prop != null) { return(prop); } prop = LookupReflectionProperty(reader); return(prop); }
public XamlPropertyElement(XamlParser parser, string name, XamlPropertySetter setter) : base(parser, name) { Setter = setter; DetermineIfSetOnAdd(); }
private object ParseAttributeValue (XamlObjectElement element, XamlPropertySetter property) { object value = null; if (IsMarkupExpression (reader.Value)) value = ParseAttributeMarkup (element, property); else { value = XamlTypeConverter.ConvertObject (this, element, property.Type, property.Converter, property.Name, reader.Value); } return value; }
private object ParseAttributeMarkup (XamlObjectElement element, XamlPropertySetter property) { MarkupExpressionParser parser = new SL4MarkupExpressionParser (element.Object, property.Name, this, element); string expression = reader.Value; object o = parser.ParseExpression (ref expression); return o; }
private object ParseAttributeMarkup (XamlObjectElement element, XamlPropertySetter property, XamlAttribute ai) { MarkupExpressionParser parser = new SL4MarkupExpressionParser (element.Object, property.Name, this, element); string expression = ai.Value; object o = null; try { o = parser.ParseExpression (ref expression); } catch (Exception e) { throw ParseException ("Could not convert attribute value '{0}' on element {1} for property {2}.", ai.Value, element.Name, property.Name); } if (o == null && !MarkupExpressionParser.IsExplicitNull (expression)) throw ParseException ("Unable to convert attribute value: '{0}'.", ai.Value); return property.ConvertValue (property.Type, o); }
private object ParseAttributeValue (XamlObjectElement element, XamlPropertySetter property, XamlAttribute ai) { object value = null; if (IsMarkupExpression (ai.Value)) value = ParseAttributeMarkup (element, property, ai); else { try { value = property.ConvertTextValue (ai.Value); } catch (Exception ex) { throw ParseException ("Could not convert attribute value '{0}' on element {1} for property {2}.", ai.Value, element.Name, property.Name); } } return value; }
public XamlPropertyElement (XamlParser parser, string name, XamlPropertySetter setter) : base (parser, name) { Setter = setter; DetermineIfSetOnAdd (); }
private object ParseAttributeValue (XamlObjectElement element, XamlPropertySetter property) { object value = null; if (IsMarkupExpression (reader.Value)) value = ParseAttributeMarkup (element, property); else { value = property.ConvertTextValue (reader.Value); } return value; }
public XamlPropertyElement (XamlParser parser, string name, XamlPropertySetter setter) : base (parser, name) { Setter = setter; }