内部鉴于这一XAML:画布背景忽略当VisualBrush
<Style TargetType="PasswordBox">
<Setter Property="Background">
<Setter.Value>
<VisualBrush TileMode="Tile"
Viewport="0,0,10,10" ViewportUnits="Absolute">
<VisualBrush.Visual>
<Canvas Background="{x:Static SystemColors.WindowBrush}">
<Path Data="M0,0 L10,10 M0,10 L10,0">
<Path.Stroke>
<SolidColorBrush Color="{x:Static SystemColors.HighlightColor}"/>
</Path.Stroke>
</Path>
</Canvas>
</VisualBrush.Visual>
</VisualBrush>
</Setter.Value>
</Setter>
...
画布背景被忽略,取而代之的路径是在一个背景这是透明的PasswordBox背后的形式可见。那么我应该在哪里设置“背景背景”?
我会想象,将其设置为'WindowBrush'使其与背后的窗体相同。你确定它不只是相同的颜色?你尝试过一些类似'Background =“Red”'的东西吗? – Jay
WindowBrush评估为不透明颜色。红色也被忽略。 – Reinderien
如何在'Path.Fill'上设置画笔? – Jay