<StackPanel.Resources> <Style x:Key="ControlBaseStyle" TargetType="{x:Type FrameworkElement}"> <Setter Property="Margin" Value="55,0,0,0" /> </Style> <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource ControlBaseStyle}"/> </StackPanel.Resources>
以上代码能实现多种控件之间的Margin这种常用属性的复用