在两个不同的窗口中,是否可能继承相同的ControlTemplate样式?我是wpf的新手,不确定如何做到这一点,甚至不知道是否可能实现。 例如,如果在Window1.xaml中有以下内容:
<Window.Resources>
<ControlTemplate x:Key="myStyle" TargetType="Button">
...
</ControlTemplate>
</Window.Resources>
同时,在Window2.xaml中,我想这样使用它:
<Grid>
<Grid.Resources>
<Style TargetType="Button" BasedOn="{StaticResource myStyle}">
...
</Style>
</Grid.Resources>
<Grid>
如何从第一个窗口导入样式?