Пример #1
0
        public static IList <DependencyProperty> FromType(Type ownerType)
        {
            if (ownerType == null)
            {
                throw new ArgumentNullException("ownerType");
            }

            // Ensure static constructor of type has run
            RuntimeHelpers.RunClassConstructor(ownerType.TypeHandle);

            List <DependencyProperty> filteredProperties = new List <DependencyProperty>();

            lock (((ICollection)DependencyProperty.dependencyProperties).SyncRoot)
            {
                foreach (DependencyProperty dependencyProperty in DependencyProperty.dependencyProperties.Values)
                {
                    if (TypeProvider.IsSubclassOf(ownerType, dependencyProperty.ownerType) ||
                        ownerType == dependencyProperty.ownerType)
                    {
                        filteredProperties.Add(dependencyProperty);
                    }
                }
            }

            return(filteredProperties.AsReadOnly());
        }
Пример #2
0
        public static IList <DependencyProperty> FromType(Type ownerType)
        {
            if (ownerType == null)
            {
                throw new ArgumentNullException("ownerType");
            }
            RuntimeHelpers.RunClassConstructor(ownerType.TypeHandle);
            List <DependencyProperty> list = new List <DependencyProperty>();

            lock (((ICollection)dependencyProperties).SyncRoot)
            {
                foreach (DependencyProperty property in dependencyProperties.Values)
                {
                    if (TypeProvider.IsSubclassOf(ownerType, property.ownerType) || (ownerType == property.ownerType))
                    {
                        list.Add(property);
                    }
                }
            }
            return(list.AsReadOnly());
        }