【发布时间】:2011-03-19 02:01:58
【问题描述】:
是否可以在两个不同的窗口中为 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>
如何从第一个窗口导入样式?
【问题讨论】: