假设我有一个包含4个边框的UserControl:
<Border />
<Border />
<Border />
<Border />
现在我可以在我的资源中进行:
<Style TargetType="{x:Type Border}">
... change some properties here
</Style>
现在这一切都很好,但是它将会针对我用户控件中的所有边框。 但是如果我只想针对其中的一部分怎么办?
我想要:
<Border Class="Type1" />
<Border Class="Type1" />
<Border />
<Border />
然后继续:
<Style TargetType="{x:Type Border}" TargetClass="Type1">
... change some properties here
</Style>
但是显然这个不存在,有没有其他方法可以实现我想要的?谢谢