示例#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);
        }
示例#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);
        }
示例#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);
            }
        }
示例#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));
        }
示例#5
0
 internal static PropertyPath CreatePropertyPath(string propertyName)
 {
     return(new PropertyPath(DependencyPropertyManager.GetExpandoProperty(propertyName)));
 }
示例#6
0
 public ExpandoValueProvider(DependencyObject target, string propertyName) : base(ValueProviderOptions.LongLife)
 {
     _target   = target;
     _property = DependencyPropertyManager.GetExpandoProperty(propertyName);
 }
示例#7
0
 public static object GetExpandoValue(this DependencyObject depObj, string propertyName)
 {
     return(depObj.GetValue(DependencyPropertyManager.GetExpandoProperty(propertyName)));
 }
示例#8
0
 public static void SetExpandoValue(this DependencyObject depObj, string propertyName, object value)
 {
     depObj.SetValue(DependencyPropertyManager.GetExpandoProperty(propertyName), value);
 }
示例#9
0
 public static void SetExpandoBinding(this DependencyObject depObj, string propertyName, Binding binding)
 {
     BindingOperations.SetBinding(depObj, DependencyPropertyManager.GetExpandoProperty(propertyName), binding);
 }