Beispiel #1
0
        public static DependencyProperty GetDependencyProperty(this IPropertyPathElement propertyPathElement, Type containingType)
        {
            DependencyProperty dependencyProperty;

            if (propertyPathElement.TryGetDependencyProperty(containingType, out dependencyProperty))
            {
                return(dependencyProperty);
            }

            throw new Granular.Exception("Type \"{0}\" does not contain a dependency property \"{1}\"", containingType.Name, propertyPathElement);
        }
        public ObservableExpression(object baseValue, PropertyPath propertyPath)
        {
            observableValue = new ObservableValue();
            observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e);

            if (propertyPath.IsEmpty)
            {
                observableValue.Value = baseValue;
                ValueType = baseValue != null ? baseValue.GetType() : null;
            }
            else
            {
                propertyPathElement = propertyPath.Elements.Last();

                baseObserver = new ObservableExpression(baseValue, propertyPath.GetBasePropertyPath());
                baseObserver.ValueChanged += (sender, e) => SetDelegateObserverBaseValue();

                SetDelegateObserverBaseValue();
            }
        }
        public ObservableExpression(object baseValue, PropertyPath propertyPath)
        {
            observableValue = new ObservableValue();
            observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e);

            if (propertyPath.IsEmpty)
            {
                observableValue.Value = baseValue;
                ValueType             = baseValue != null?baseValue.GetType() : null;
            }
            else
            {
                propertyPathElement = propertyPath.Elements.Last();

                baseObserver = new ObservableExpression(baseValue, propertyPath.GetBasePropertyPath());
                baseObserver.ValueChanged += (sender, e) => SetDelegateObserverBaseValue();

                SetDelegateObserverBaseValue();
            }
        }
Beispiel #4
0
        public static PropertyPath Insert(this PropertyPath propertyPath, int index, IPropertyPathElement element)
        {
            IEnumerable <IPropertyPathElement> elements = propertyPath.Elements.Take(index).Concat(new [] { element }).Concat(propertyPath.Elements.Skip(index)).ToArray();

            return(new PropertyPath(elements));
        }
Beispiel #5
0
 public static PropertyPath Insert(this PropertyPath propertyPath, int index, IPropertyPathElement element)
 {
     IEnumerable<IPropertyPathElement> elements = propertyPath.Elements.Take(index).Concat(new [] { element }).Concat(propertyPath.Elements.Skip(index)).ToArray();
     return new PropertyPath(elements);
 }