예제 #1
0
        public void SetIsInDesignMode()
        {
            Assert.Throws <ArgumentNullException> (delegate {
                DesignerProperties.SetIsInDesignMode(null, true);
            }, "null");

            Assert.Throws <NotImplementedException> (delegate {
                DesignerProperties.SetIsInDesignMode(rect, true);
            }, "Rectangle/True");

            rect.SetValue(DesignerProperties.IsInDesignModeProperty, true);
            Assert.IsInstanceOfType <bool>(rect.ReadLocalValue(DesignerProperties.IsInDesignModeProperty), "locally set");
            Assert.IsTrue((bool)rect.GetValue(DesignerProperties.IsInDesignModeProperty), "#getter true");
            Assert.IsFalse(DesignerProperties.GetIsInDesignMode(rect), "Rectangle/SetValue/False/1");
            Assert.IsTrue((bool)rect.GetValue(DesignerProperties.IsInDesignModeProperty), "Rectangle/GetValue/True");

            Assert.Throws <NotImplementedException> (delegate {
                DesignerProperties.SetIsInDesignMode(rect, false);
            }, "Rectangle/False");

            rect.SetValue(DesignerProperties.IsInDesignModeProperty, false);
            Assert.IsFalse(DesignerProperties.GetIsInDesignMode(rect), "Rectangle/SetValue/False/2");
            Assert.IsFalse((bool)rect.GetValue(DesignerProperties.IsInDesignModeProperty), "Rectangle/GetValue/False");

            DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, true);
            Assert.IsTrue(DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual), "Is in design");

            Assert.Throws <NotImplementedException>(delegate {
                DesignerProperties.SetIsInDesignMode(rect, true);
            }, "Rectangle/False");
        }
예제 #2
0
파일: TextBoxTest.cs 프로젝트: ynkbt/moon
        public void InputScope()
        {
            Assert.Throws <NotImplementedException> (delegate {
                Assert.IsNull(box.InputScope);                  // get
            }, "get_InputScope");
            Assert.Throws <NotImplementedException> (delegate {
                box.InputScope = null;
            }, "set_InputScope");

            Assert.IsNull(box.GetValue(TextBox.InputScopeProperty), "GetValue");

            InputScope i = null;

            box.SetValue(TextBox.InputScopeProperty, i);              // null works

            DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, true);
            try {
                i = new InputScope();
            }
            finally {
                DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, false);
            }

            Assert.Throws <NotImplementedException> (delegate {
                box.SetValue(TextBox.InputScopeProperty, i);
            }, "SetValue");
        }
예제 #3
0
        /// <summary>
        /// Creates an instance of the specified type, passing the specified arguments to its constructor.
        /// </summary>
        public virtual object CreateInstance(Type type, params object[] arguments)
        {
            var instance  = Activator.CreateInstance(type, arguments);
            var uiElement = instance as UIElement;

            if (uiElement != null)
            {
                DesignerProperties.SetIsInDesignMode(uiElement, true);
            }
            return(instance);
        }
예제 #4
0
        public void DontFreezeInDesignTime()
        {
            var selector = new DXDataTemplateSelector();

            DesignerProperties.SetIsInDesignMode(selector.Items, true);
            selector.Items.Add(new DXDataTemplateTrigger()
            {
                Template = TextBoxTemplate
            });
            Assert.AreEqual(TextBoxTemplate, selector.SelectTemplate(new TestData(), null));

            Assert.IsFalse(selector.Items.IsFrozen);
            selector.Items.Add(new DXDataTemplateTrigger());
        }
예제 #5
0
        public DesignPanel()
        {
            this.Focusable = true;
            this.Margin    = new Thickness(16);
            DesignerProperties.SetIsInDesignMode(this, true);

            _eatAllHitTestRequests            = new EatAllHitTestRequests();
            _eatAllHitTestRequests.MouseDown += delegate {
                // ensure the design panel has focus while the user is interacting with it
                this.Focus();
            };
            _eatAllHitTestRequests.AllowDrop = true;
            _adornerLayer = new AdornerLayer(this);
        }
예제 #6
0
        public void InDesign_BadValue()
        {
            InputScopeName isn = null;

            DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, true);
            try {
                // creation time limitation only
                isn = new InputScopeName((InputScopeNameValue)Int32.MinValue);
            }
            finally {
                DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, false);
            }

            Assert.AreEqual((InputScopeNameValue)Int32.MinValue, isn.NameValue, "bad-value");
        }
예제 #7
0
        public void CurrentApplication()
        {
            Assert.IsFalse(DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual), "Current");
            DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, true);
            try {
                Assert.IsTrue(DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual), "GetIsInDesignMode/true");
                Assert.IsTrue((bool)Application.Current.RootVisual.GetValue(DesignerProperties.IsInDesignModeProperty), "GetValue/true");

                Application.Current.RootVisual.SetValue(DesignerProperties.IsInDesignModeProperty, false);
                Assert.IsFalse(DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual), "GetIsInDesignMode/false");
                Assert.IsFalse((bool)Application.Current.RootVisual.GetValue(DesignerProperties.IsInDesignModeProperty), "GetValue/false");
            }
            finally {
                DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, false);
            }
        }
        public void InDesign()
        {
            ManipulationStartedEventArgs msea = null;

            DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, true);
            try {
                // creation time limitation only
                msea = new ManipulationStartedEventArgs();
            }
            finally {
                DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, false);
            }

            Assert.IsFalse(msea.Handled, "Handled");
            Assert.IsNull(msea.ManipulationContainer, "ManipulationContainer");
            Assert.AreEqual(new Point(0, 0), msea.ManipulationOrigin, "ManipulationOrigin");
            Assert.IsNull(msea.OriginalSource, "OriginalSource");
        }
예제 #9
0
        public void InDesign()
        {
            ManipulationDeltaEventArgs mdea = null;

            DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, true);
            try {
                // creation time limitation only
                mdea = new ManipulationDeltaEventArgs();
            }
            finally {
                DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, false);
            }

            Assert.IsNull(mdea.CumulativeManipulation, "CumulativeManipulation");
            Assert.IsNull(mdea.DeltaManipulation, "DeltaManipulation");
            Assert.IsFalse(mdea.Handled, "Handled");
            Assert.IsFalse(mdea.IsInertial, "IsInertial");
            Assert.IsNull(mdea.ManipulationContainer, "ManipulationContainer");
            Assert.AreEqual(new Point(0, 0), mdea.ManipulationOrigin, "ManipulationOrigin");
            Assert.IsNull(mdea.OriginalSource, "OriginalSource");
            Assert.IsNull(mdea.Velocities, "Velocities");
        }
예제 #10
0
        public void InDesign()
        {
            InputScope     i   = null;
            InputScopeName isn = null;

            DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, true);
            try {
                // creation time limitation only
                i   = new InputScope();
                isn = new InputScopeName(InputScopeNameValue.AddressCity);
            }
            finally {
                DesignerProperties.SetIsInDesignMode(Application.Current.RootVisual, false);
            }

            Assert.AreEqual(0, i.Names.Count, "Count");
            Assert.IsFalse(i.Names.IsFixedSize, "IsFixedSize");
            Assert.IsFalse(i.Names.IsReadOnly, "IsReadOnly");
            Assert.IsInstanceOfType <List <InputScopeName> > (i.Names, "type");

            i.Names.Add(isn);
            Assert.AreEqual(1, i.Names.Count, "1");
        }
예제 #11
0
 internal AdornerLayer()
 {
     this.InheritanceBehavior = InheritanceBehavior.SkipToAppNext;
     DesignerProperties.SetIsInDesignMode((DependencyObject)this, false);
 }