Ejemplo n.º 1
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(() => {
         Assert.IsNotNull(box.SelectionForeground, "#4");
         Assert.IsUnset(box, PasswordBox.SelectionForegroundProperty, "#5");
     });
     Enqueue (() => {
         box.ClearValue(PasswordBox.SelectionForegroundProperty);
         Assert.IsNull(box.SelectionForeground, "#6");
     });
     EnqueueTestComplete();
 }
Ejemplo n.º 2
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();
        }