2
我的任务是在每个StackPanel中嵌套20px的边距的每个Button上设置。在Silverlight而不是WPF中嵌套样式(如CSS)的吊坠
在WPF我使用这段代码Application.Resources:
<Style TargetType="StackPanel">
<Style.Resources>
<Style TargetType="Button">
<Setter Property="Margin" Value="20" />
</Style>
</Style.Resources>
</Style>
在Silverlight中存在缺少 “Style.Resources” -Tag。但我试过这个代码:
<Style TargetType="StackPanel">
<Setter Property="Resources">
<Setter.Value>
<ResourceDictionary>
<Style TargetType="Button">
<Setter Property="Margin" Value="20" />
</Style>
</ResourceDictionary>
</Setter.Value>
</Setter>
</Style>
可悲的是在Silverlight方面没有任何事情发生(没有错误,没有结果)。
有没有人有一个想法,如果在Silverlight中,这种行为可能没有在每个Stackpanel manualy上设置Style by键?