【发布时间】:2009-11-06 02:14:07
【问题描述】:
<UserControl x:Class="FlowItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300">
<UserControl.Resources>
<Style TargetType="Label">
<Style.Setters>
<Setter Property="Background" Value="AliceBlue" ></Setter>
</Style.Setters>
</Style>
</UserControl.Resources>
<DockPanel Height="300" Width="300" LastChildFill="False" Background="Transparent">
<Label Height="28" DockPanel.Dock="Top"></Label>
<Label Height="28" DockPanel.Dock="Bottom">What ever</Label>
<Label Width="28" DockPanel.Dock="Left"></Label>
<Label Width="28" DockPanel.Dock="Right"></Label>
</DockPanel>
如何通过样式设置标签的背景? 谢谢!
【问题讨论】:
-
我的问题是这个 XAML 在 VS2008 中无法编译,并显示错误消息:“SetterCollectionBase”在使用(密封)后,无法修改。