Esempio n. 1
0
        public static DependencyProperty ResolveProperty(IPropertySubject interactivityObject)
        {
            if (((InteractivityObject)interactivityObject).IsLoaded == false)
            {
                return(null);
            }

            var propertyKind = interactivityObject.PropertyKind;
            var isResolved   = IsResolved(interactivityObject);

            if (isResolved)
            {
                return(interactivityObject.PropertyStore as DependencyProperty);
            }

            switch (propertyKind)
            {
            case PropertyKind.Explicit:
                interactivityObject.PropertyKind |= PropertyKind.Resolved;
                return((DependencyProperty)interactivityObject.PropertyStore);

            case PropertyKind.Implicit:
            {
                var subject = interactivityObject.ActualSubject;

                if (subject == null)
                {
                    return(null);
                }

                var resolvedProperty = DependencyPropertyManager.GetDependencyProperty((string)interactivityObject.PropertyStore, subject.GetType());

                if (resolvedProperty != null)
                {
                    interactivityObject.PropertyStore = resolvedProperty;
                }

                interactivityObject.PropertyKind |= PropertyKind.Resolved;

                return(resolvedProperty);
            }

            case PropertyKind.Expando:
            {
                var resolvedProperty = DependencyPropertyManager.GetExpandoProperty((string)interactivityObject.PropertyStore);

                interactivityObject.PropertyStore = resolvedProperty;
                interactivityObject.PropertyKind |= PropertyKind.Resolved;

                return(resolvedProperty);
            }
            }

            return(null);
        }
Esempio n. 2
0
        public static DependencyProperty ResolveProperty(IPropertySubject interactivityObject, Type targetType)
        {
            var propertyKind = interactivityObject.PropertyKind & PropertyKind.Unspecified;

            switch (propertyKind)
            {
            case PropertyKind.Explicit:
                return((DependencyProperty)GetProperty(interactivityObject));

            case PropertyKind.Implicit:
                return(DependencyPropertyManager.GetDependencyProperty(GetProperty(interactivityObject) as string, targetType));

            case PropertyKind.Expando:
                return(DependencyPropertyManager.GetExpandoProperty(GetExpandoProperty(interactivityObject)));
            }

            return(null);
        }
Esempio n. 3
0
        public static void SetExpandoValue(this DependencyObject depObj, string propertyName, object value, bool skipPropertyChangedHandler)
        {
            if (skipPropertyChangedHandler == false)
            {
                SetExpandoValue(depObj, propertyName, value);

                return;
            }

            var prop = DependencyPropertyManager.GetExpandoProperty(propertyName);

            try
            {
                depObj.SuspendPropertyChangedCallback(prop);

                SetValue(depObj, prop, value);
            }
            finally
            {
                depObj.ResumePropertyChangedCallback(prop);
            }
        }
Esempio n. 4
0
        public static DependencyProperty GetServiceProperty(IPropertySubject interactivityObject)
        {
            var propertyKind = interactivityObject.PropertyKind;
            var isResolved   = (propertyKind & PropertyKind.Resolved) != 0;

            propertyKind &= PropertyKind.Unspecified;

            if (propertyKind == PropertyKind.Unspecified)
            {
                return(null);
            }

            if (propertyKind == PropertyKind.Explicit)
            {
                return((DependencyProperty)interactivityObject.PropertyStore);
            }

            if (propertyKind == PropertyKind.Expando)
            {
                if (isResolved)
                {
                    return((DependencyProperty)interactivityObject.PropertyStore);
                }

                var resolvedProperty = DependencyPropertyManager.GetExpandoProperty((string)interactivityObject.PropertyStore);

                interactivityObject.PropertyStore = resolvedProperty;
                interactivityObject.PropertyKind |= PropertyKind.Resolved;

                return(resolvedProperty);
            }

            var propertyName = interactivityObject.PropertyStore as string ?? ((DependencyProperty)interactivityObject.PropertyStore).GetName();

            return(DependencyPropertyProxyManager.GetDependencyProperty(propertyName));
        }
Esempio n. 5
0
 internal static PropertyPath CreatePropertyPath(string propertyName)
 {
     return(new PropertyPath(DependencyPropertyManager.GetExpandoProperty(propertyName)));
 }
Esempio n. 6
0
 public ExpandoValueProvider(DependencyObject target, string propertyName) : base(ValueProviderOptions.LongLife)
 {
     _target   = target;
     _property = DependencyPropertyManager.GetExpandoProperty(propertyName);
 }
Esempio n. 7
0
 public static object GetExpandoValue(this DependencyObject depObj, string propertyName)
 {
     return(depObj.GetValue(DependencyPropertyManager.GetExpandoProperty(propertyName)));
 }
Esempio n. 8
0
 public static void SetExpandoValue(this DependencyObject depObj, string propertyName, object value)
 {
     depObj.SetValue(DependencyPropertyManager.GetExpandoProperty(propertyName), value);
 }
Esempio n. 9
0
 public static void SetExpandoBinding(this DependencyObject depObj, string propertyName, Binding binding)
 {
     BindingOperations.SetBinding(depObj, DependencyPropertyManager.GetExpandoProperty(propertyName), binding);
 }