C# 我可以根据视图继承的接口类型将样式应用于视图吗?
我在我的资源字典中声明了一个样式C# 我可以根据视图继承的接口类型将样式应用于视图吗?,c#,xaml,inheritance,C#,Xaml,Inheritance,我在我的资源字典中声明了一个样式 <Style TargetType="Window"> <Setter Property="Width" Value="500"/> <Setter Property="Height" Value="300"/> </Style> <Style TargetType="Window"> <Setter Property="Width" Value="800"/>
<Style TargetType="Window">
<Setter Property="Width" Value="500"/>
<Setter Property="Height" Value="300"/>
</Style>
<Style TargetType="Window">
<Setter Property="Width" Value="800"/>
<Setter Property="Height" Value="600"/>
</Style>
我希望第一种样式应用于从IDialogWindow继承的视图,第二种样式应用于从IMainWindow继承的视图
编辑:其思想是在整个应用程序中根据窗口类型强制使用样式。当您有
部分类时,它应该使用哪种样式您的窗口:window、IDialogWindow、IMainWindow
?我不会继承同一类上的IDialogWindow
和IMainWindow
。好的,在这种情况下,您可以使用两个抽象类来代替从Windows派生的接口吗?如果是,这是很容易做到的,如果不是,这是相当困难的(我不知道我的头顶上可以怎么做)