private void RemovePropertyChanged(DependencyObjectType type, DependencyPropertyChangedEventHandler handler)
 {
     if (type != doType && !type.IsSubclassOf(doType))
     {
         throw new ArgumentException();
     }
     handlers.RemoveHandler(type, handler);
 }
        public void IsInstanceOfType()
        {
            DependencyObjectType t  = DependencyObjectType.FromSystemType(typeof(TestDepObj));
            DependencyObjectType t2 = DependencyObjectType.FromSystemType(typeof(TestSubclass));

            Assert.IsTrue(t.IsInstanceOfType(new TestSubclass()));
            Assert.IsTrue(t2.IsSubclassOf(t));
            Assert.IsFalse(t.IsSubclassOf(t2));
        }
        // Token: 0x06002EEF RID: 12015 RVA: 0x000D3ED4 File Offset: 0x000D20D4
        private bool _HitTest(Point pt, out UIElement e)
        {
            e = null;
            HitTestResult hitTestResult = VisualTreeHelper.HitTest(this.FixedPage, pt);

            for (DependencyObject dependencyObject = (hitTestResult != null) ? hitTestResult.VisualHit : null; dependencyObject != null; dependencyObject = VisualTreeHelper.GetParent(dependencyObject))
            {
                DependencyObjectType dependencyObjectType = dependencyObject.DependencyObjectType;
                if (dependencyObjectType == FixedTextView.UIElementType || dependencyObjectType.IsSubclassOf(FixedTextView.UIElementType))
                {
                    e = (UIElement)dependencyObject;
                    return(true);
                }
            }
            return(false);
        }
Пример #4
0
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        // hit testing to find the inner most UIElement that was hit
        // as well as the containing fixed page.
        private bool _HitTest(Point pt, out UIElement e)
        {
            e = null;

            HitTestResult    result = VisualTreeHelper.HitTest(this.FixedPage, pt);
            DependencyObject v      = (result != null) ? result.VisualHit : null;

            while (v != null)
            {
                DependencyObjectType t = v.DependencyObjectType;
                if (t == UIElementType || t.IsSubclassOf(UIElementType))
                {
                    e = (UIElement)v;

                    return(true);
                }
                v = VisualTreeHelper.GetParent(v);
            }

            return(false);
        }