开发中遇到运行指定页面时一片空白,逐步查是ControlTemplate中TargetType指定就可以了。
<Style x:Key="HeaderStyle" TargetType="sdk:DataGridColumnHeader" >
<Setter Property="Foreground" Value="#FF000000" /> <Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="sdk:DataGridColumnHeader"> <ContentPresenter Content="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" /> </ControlTemplate> </Setter.Value> </Setter> </Style>