mui:DataGridTextColumn.HeaderStyle Setter overwriting everything

Aug 23, 2013 at 1:10 PM
When I try to set the text align of a datagrid header colum it changes the whole style of the header to a gray button???

Am I missing something below is my code.
<mui:DataGridTextColumn Header="Completion Date" Binding="{Binding CompletionDate, StringFormat=\{0:MM/dd/yy\}}">
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Right" />
Aug 25, 2013 at 1:22 PM
Same question here. Would like to know how do you use "BasedOn" from assembly..
Aug 26, 2013 at 12:57 PM
To derive your custom style from the mui style make sure you use the following:
<Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}" />
Aug 26, 2013 at 4:36 PM
That did it! Thanks!
Dec 2, 2013 at 3:55 AM
This (unfortunately) does not work for me. Maybe I made a mistake somewhere in my code?
        <Style x:Key="LeftAlignedCHStyle" TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="ToolTip" Value="Click to sort."/>
        <Style x:Key="CenteredCHStyle" TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="ToolTip" Value="Click to sort."/>
<DataGridTextColumn Header="HeaderText" HeaderStyle="{DynamicResource LeftAlignedCHStyle}" Binding="{Binding Path=foobar}" MinWidth="50" />
<DataGridTemplateColumn Header="Delete" HeaderStyle="{DynamicResource CenteredCHStyle}">...</DataGridTemplateColumn>
DynamicResource is accepted by the compiler but produces the grey button. StaticResource ignored at runtime.

What's the XAML noob mistake I am have made but am yet to see?