我在app.xaml中有一个DataTemplate,它将一个视图绑定到一个视图模型。
<Application.Resources>
<DataTemplate DataType="{x:Type vm:someviewmodeltype}">
<vw:somevwcontrol />
</DataTemplate>
</Application.Resources>
如果没有样式,上面的模板就不会被应用。一旦我添加了样式,就像...
<Application.Resources>
<DataTemplate DataType="{x:Type vm:someviewmodeltype}">
<vw:somevwcontrol />
</DataTemplate>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="20"></Setter>
</Style>
</Application.Resources>
datatemplate被获取并生成了期望的结果... 我不确定正在发生什么... 有人可以澄清一下吗?
谢谢。