상속: DependencyProperty
예제 #1
0
        private static bool LookupInternal(Kind declaring_kind, string name, Type property_type, bool create, out DependencyProperty property)
        {
            IntPtr handle;

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (create && property_type == null)
            {
                throw new ArgumentNullException("property_type");
            }

            if (declaring_kind == Kind.INVALID)
            {
                throw new ArgumentOutOfRangeException("declaring_kind");
            }

            if (property_type != null)
            {
                Deployment.Current.Types.Find(property_type);
            }

            handle = NativeMethods.dependency_property_get_dependency_property_full(declaring_kind, name, true);

            if (handle == IntPtr.Zero)
            {
                property = null;
                return(false);
            }
            if (properties.TryGetValue(handle, out property))
            {
                return(true);
            }

            if (create)
            {
                property = new CoreDependencyProperty(handle, name, property_type, Deployment.Current.Types.KindToType(declaring_kind));
            }

            return(property != null);
        }
예제 #2
0
        private static bool LookupInternal(Kind declaring_kind, string name, Type property_type, bool create, out DependencyProperty property)
        {
            IntPtr handle;

            if (name == null)
                throw new ArgumentNullException ("name");

            if (create && property_type == null)
                throw new ArgumentNullException ("property_type");

            if (declaring_kind == Kind.INVALID)
                throw new ArgumentOutOfRangeException ("declaring_kind");

            if (property_type != null)
                Deployment.Current.Types.Find (property_type);

            handle = NativeMethods.dependency_property_get_dependency_property_full (declaring_kind, name, true);

            if (handle == IntPtr.Zero) {
                property = null;
                return false;
            }
            if (properties.TryGetValue (handle, out property))
                return true;

            if (create) {
                property = new CoreDependencyProperty (handle, name, property_type, Deployment.Current.Types.KindToType (declaring_kind));
            }

            return property != null;
        }