【发布时间】:2012-09-28 18:15:32
【问题描述】:
鉴于此 XAML:
<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"之类的吗? -
WindowBrush 评估为不透明颜色。红色也会被忽略。
-
在
Path.Fill上设置那个画笔怎么样? -
刚试过;这也被忽略和透明。
标签: wpf xaml background drawing