2
我在App.xaml中设置一些风格全局样式
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value ="HotPink"/>
</Style>
这种风格适用于正常对照组,而不是里面的DataTemplates
<TextBlock Text="Test"></TextBlock> <!-- Works here -->
<ItemsControl ItemsSource="{Binding ViewModel.UniverseGroups}" HorizontalAlignment="Right" VerticalAlignment="Center">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RelativePanel>
<TextBlock Text="{Binding Name}"></TextBlock>
<!-- This text still is black -->
</RelativePanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
有没有一种方法,使全球样式甚至可以在DataTemplates中工作?
对我来说也行得通! – AntiHeadshot