1
我有xaml样式具有不同的目标类型,但在其他方面相同。有没有办法可以删除重复并只定义一次样式?复制XAML样式
<Style TargetType="TextBlock">
<Setter Property="Height" Value="{StaticResource ElementHeight}"/>
<Setter Property="MinWidth" Value="{StaticResource ElementMinWidth}"/>
<Setter Property="Margin" Value="{StaticResource ElementMargin}"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="Height" Value="{StaticResource ElementHeight}"/>
<Setter Property="MinWidth" Value="{StaticResource ElementMinWidth}"/>
<Setter Property="Margin" Value="{StaticResource ElementMargin}"/>
</Style>
<Style TargetType="ComboBox">
<Setter Property="Height" Value="{StaticResource ElementHeight}"/>
<Setter Property="MinWidth" Value="{StaticResource ElementMinWidth}"/>
<Setter Property="Margin" Value="{StaticResource ElementMargin}"/>
</Style>
感谢。我不知道为什么我没有考虑瞄准'FrameworkElement'。 –