コード例 #1
0
ファイル: Storyboard.cs プロジェクト: portalninja/Granular
        private static bool TryGetPropertyPathTarget(DependencyObject root, PropertyPath propertyPath, out DependencyObject target, out DependencyProperty targetProperty)
        {
            object baseValue;

            target = propertyPath.Elements.Count() > 1 && propertyPath.GetBasePropertyPath().TryGetValue(root, out baseValue) ? baseValue as DependencyObject : root;

            if (target != null && !propertyPath.IsEmpty)
            {
                return(propertyPath.Elements.Last().TryGetDependencyProperty(target.GetType(), out targetProperty));
            }

            target         = null;
            targetProperty = null;
            return(false);
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
ファイル: Storyboard.cs プロジェクト: highzion/Granular
        private static bool TryGetPropertyPathTarget(DependencyObject root, PropertyPath propertyPath, out DependencyObject target, out DependencyProperty targetProperty)
        {
            object baseValue;
            target = propertyPath.Elements.Count() > 1 && propertyPath.GetBasePropertyPath().TryGetValue(root, out baseValue) ? baseValue as DependencyObject : root;

            if (target != null && !propertyPath.IsEmpty)
            {
                return propertyPath.Elements.Last().TryGetDependencyProperty(target.GetType(), out targetProperty);
            }

            target = null;
            targetProperty = null;
            return false;
        }