本文整理汇总了C#中System.Windows.Controls.PasswordBox.ClearValue方法的典型用法代码示例。如果您正苦于以下问题:C# PasswordBox.ClearValue方法的具体用法?C# PasswordBox.ClearValue怎么用?C# PasswordBox.ClearValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.PasswordBox
的用法示例。
在下文中一共展示了PasswordBox.ClearValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectionForeground
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();
}
示例2: SelectionForeground_Styled
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();
}