Esempio n. 1
0
        public void SelectionForeground_Styled()
        {
            var brush = new SolidColorBrush(Colors.Red);
            var style = new Style(typeof(PasswordBox));

            style.Setters.Add(new Setter(PasswordBox.SelectionForegroundProperty, brush));

            var box = new PasswordBox {
                Style = style
            };

            Assert.AreSame(brush, box.SelectionForeground, "#1");
            TestPanel.Children.Add(box);
            Assert.AreSame(brush, box.SelectionForeground, "#2");
            box.UpdateLayout();
            Assert.AreSame(brush, box.SelectionForeground, "#3");
            Enqueue(() => {
                Assert.AreSame(brush, box.SelectionForeground, "#4");
                Assert.IsUnset(box, PasswordBox.SelectionForegroundProperty, "#5");
            });
            Enqueue(() => {
                box.ClearValue(PasswordBox.SelectionForegroundProperty);
                Assert.AreSame(brush, box.SelectionForeground, "#6");
            });
            EnqueueTestComplete();
        }
Esempio n. 2
0
        public void SelectionForeground_SetStyle_RemoveStyle()
        {
            var brush = new SolidColorBrush(Colors.Red);
            var style = new Style(typeof(PasswordBox));

            style.Setters.Add(new Setter(PasswordBox.SelectionForegroundProperty, brush));

            var box = new PasswordBox {
                Style = style
            };

            TestPanel.Children.Add(box);
            box.UpdateLayout();
            Enqueue(() => {
                box.Style = null;
                Assert.IsNull(box.SelectionForeground, "#1");
            });
            EnqueueTestComplete();
        }
Esempio n. 3
0
        public void SelectionForeground()
        {
            var box = new PasswordBox();

            Assert.IsNull(box.SelectionForeground, "#1");
            TestPanel.Children.Add(box);
            Assert.IsNull(box.SelectionForeground, "#2");
            box.UpdateLayout();
            Assert.IsNull(box.SelectionForeground, "#3");
            Enqueue(() => { });
            Enqueue(() => {
                Assert.IsNotNull(box.SelectionForeground, "#4");
                Assert.IsUnset(box, PasswordBox.SelectionForegroundProperty, "#5");
            });
            Enqueue(() => {
                box.ClearValue(PasswordBox.SelectionForegroundProperty);
                Assert.IsNull(box.SelectionForeground, "#6");
            });
            EnqueueTestComplete();
        }