public IndexPropertyObserver(Type propertyContainingType, IndexPropertyPathElement propertyPathElement, XamlNamespaces namespaces) { baseObserver = CreateBaseObserver(propertyContainingType, propertyPathElement.PropertyName); PropertyInfo indexPropertyInfo = baseObserver != null?baseObserver.ValueType.GetDefaultIndexProperty() : propertyPathElement.PropertyName.IsEmpty ? propertyContainingType.GetDefaultIndexProperty() : propertyContainingType.GetInstanceProperty(propertyPathElement.PropertyName.MemberName); if (indexPropertyInfo == null) { throw new Granular.Exception("Property \"{0}.{1}\" does not have an indexer", propertyContainingType.Name, propertyPathElement.PropertyName.MemberName); } if (indexPropertyInfo.GetIndexParameters().Count() != propertyPathElement.IndexRawValues.Count()) { throw new Granular.Exception("Invalid number of index parameters for \"{0}.{1}\"", indexPropertyInfo.DeclaringType.Name, indexPropertyInfo.Name); } indexerObserver = new ClrPropertyObserver(indexPropertyInfo, propertyPathElement.ParseIndexValues(indexPropertyInfo)); indexerObserver.ValueChanged += (sender, oldValue, newValue) => ValueChanged.Raise(this, oldValue, newValue); if (baseObserver != null) { baseObserver.ValueChanged += (sender, oldValue, newValue) => indexerObserver.SetBaseValue(baseObserver.Value); indexerObserver.SetBaseValue(baseObserver.Value); } }
public object ConvertFrom(XamlNamespaces namespaces, Uri sourceUri, object value) { return(Size.Parse(value.ToString().Trim())); }
public object ConvertFrom(XamlNamespaces namespaces, Uri sourceUri, object value) { return(new MatrixTransform { Matrix = Matrix.Parse(value.ToString()) }); }
public object ConvertFrom(XamlNamespaces namespaces, object value) { return(new PropertyPathElement(XamlName.FromPrefixedName((string)value, namespaces))); }
public object ConvertFrom(XamlNamespaces namespaces, object value) { return(PropertyPath.Parse((string)value, namespaces)); }
public static PropertyPath Parse(string value, XamlNamespaces namespaces = null) { PropertyPathParser parser = new PropertyPathParser(value, namespaces ?? XamlNamespaces.Empty); return(new PropertyPath(parser.Parse())); }
public IndexPropertyPathElement(XamlName propertyName, IEnumerable <string> indexRawValues, XamlNamespaces namespaces) { this.PropertyName = propertyName; this.IndexRawValues = indexRawValues; this.namespaces = namespaces; }