示例#1
0
        internal static DependencyProperty FromName(string name, Type ownerType)
        {
            DependencyProperty dependencyProperty = null;

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (!(ownerType != null))
            {
                throw new ArgumentNullException("ownerType");
            }
            FromNameKey fromNameKey = new FromNameKey(name, ownerType);

            while (dependencyProperty == null && ownerType != null)
            {
                SecurityHelper.RunClassConstructor(ownerType);
                fromNameKey.UpdateNameKey(ownerType);
                lock (Synchronized) {
                    dependencyProperty = (DependencyProperty)PropertyFromName[fromNameKey];
                }
                ownerType = ownerType.BaseType;
            }
            return(dependencyProperty);
        }
示例#2
0
        [FriendAccessAllowed]   // Built into Base, also used by Framework.
        internal static DependencyProperty FromName(string name, Type ownerType)
        {
            DependencyProperty dp = null;

            if (name != null)
            {
                if (ownerType != null)
                {
                    FromNameKey key = new FromNameKey(name, ownerType);

                    while ((dp == null) && (ownerType != null))
                    {
                        // Ensure static constructor of type has run
                        MS.Internal.WindowsBase.SecurityHelper.RunClassConstructor(ownerType);

                        // Locate property
                        key.UpdateNameKey(ownerType);

                        lock (Synchronized)
                        {
                            dp = (DependencyProperty)PropertyFromName[key];
                        }

                        ownerType = ownerType.BaseType;
                    }
                }
                else
                {
                    throw new ArgumentNullException("ownerType");
                }
            }
            else
            {
                throw new ArgumentNullException("name");
            }
            return(dp);
        }
        [FriendAccessAllowed]   // Built into Base, also used by Framework.
        internal static DependencyProperty FromName(string name, Type ownerType)
        {
            DependencyProperty dp = null;

            if (name != null)
            {
                if (ownerType != null)
                {
                    FromNameKey key = new FromNameKey(name, ownerType);

                    while ((dp == null) && (ownerType != null))
                    {
                        // Ensure static constructor of type has run
                        MS.Internal.WindowsBase.SecurityHelper.RunClassConstructor(ownerType);

                        // Locate property
                        key.UpdateNameKey(ownerType);

                        lock (Synchronized)
                        {
                            dp = (DependencyProperty)PropertyFromName[key];
                        }

                        ownerType = ownerType.BaseType;
                    }
                }
                else
                {
                    throw new ArgumentNullException("ownerType");
                }
            }
            else
            {
                throw new ArgumentNullException("name");
            }
            return dp;
        }