【发布时间】:2011-12-05 09:31:37
【问题描述】:
我必须为弹出窗口创建样式。我正在使用 WPF 和 .NET Framework 4。
我有写作风格:
<Style x:Key="PopupBox" TargetType="{x:Type Popup}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Popup}">
<Grid>
<Border BorderBrush="Blue" Background="#FFFFFFFF">
<Grid>
<Border Background="AliceBlue"/>
<ContentPresenter ContentSource="Header" />
<ContentPresenter/>
<Border BorderBrush="#FFFFFFFF" Background="#FFBFDBFF"/>
</Grid>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
我已经从这段代码中删除了一些元素,如网格行和列定义,因为它们并不重要。
所以看来我不能使用<Setter Property="Template"> 因为Popup 控件没有这个属性。我该如何解决这个问题?
非常感谢您的帮助!
【问题讨论】:
标签: .net wpf xaml .net-4.0 popup