public override object GetValue(object component)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }

            object value = base.GetValue(component);

            if (value == null)
            {
                // See if there is a value in the user data DesignTimeTypeNames hashtable.
                // If yes, it's probably a wrong type name.  Show the name anyway.
                DependencyObject dependencyObject = component as DependencyObject;
                if (dependencyObject != null)
                {
                    object key = DependencyProperty.FromName(this.RealPropertyDescriptor.Name, this.RealPropertyDescriptor.ComponentType);
                    value = Helpers.GetDesignTimeTypeName(dependencyObject, key);
                    if (string.IsNullOrEmpty(value as string))
                    {
                        key   = this.RealPropertyDescriptor.ComponentType.FullName + "." + this.RealPropertyDescriptor.Name;
                        value = Helpers.GetDesignTimeTypeName(dependencyObject, key);
                    }
                }
            }

            return(value);
        }
Esempio n. 2
0
        public override object GetValue(object component)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            object designTimeTypeName = base.GetValue(component);

            if (designTimeTypeName == null)
            {
                DependencyObject owner = component as DependencyObject;
                if (owner != null)
                {
                    object key = DependencyProperty.FromName(base.RealPropertyDescriptor.Name, base.RealPropertyDescriptor.ComponentType);
                    designTimeTypeName = Helpers.GetDesignTimeTypeName(owner, key);
                    if (string.IsNullOrEmpty(designTimeTypeName as string))
                    {
                        key = base.RealPropertyDescriptor.ComponentType.FullName + "." + base.RealPropertyDescriptor.Name;
                        designTimeTypeName = Helpers.GetDesignTimeTypeName(owner, key);
                    }
                }
            }
            return(designTimeTypeName);
        }