Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding DataGridRow Style #1492

Closed
killnine opened this issue Aug 5, 2014 · 1 comment
Closed

Overriding DataGridRow Style #1492

killnine opened this issue Aug 5, 2014 · 1 comment
Assignees
Milestone

Comments

@killnine
Copy link

killnine commented Aug 5, 2014

Hi guys,

I've applied the code below to a DataGrid. My goal is to get the foreground text of a row to show up red if the data trigger is met.

<DataGrid.RowStyle>
    <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource MetroDataGridRow}">
    <Setter Property="behaviors:DataGridRowDoubleClickBehavior.DoubleClickCommand" Value="{Binding ElementName=EventGrid, Path=DataContext.ModifyEventForm.OpenFormCommand}"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=IsTransferred}" Value="True">
                <Setter Property="Foreground" Value="Gray"/>
                <Setter Property="FontStyle" Value="Italic"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=OpCode}" Value="999">
                <Setter Property="Foreground" Value="DarkRed"/>
                <Setter Property="FontWeight" Value="Bold"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</DataGrid.RowStyle>

However, only the FontStyle and FontWeights are affected. I am assuming this is because the Foreground is set in MA.M's styles via Triggers on things like 'IsSelected'.

Is there a working solution for overriding things like this? I'm no master of style hierarchy in WPF :)

@punker76 punker76 self-assigned this Jan 10, 2015
@kurti-vdb
Copy link

I have the same problem. Apparently every style can be set except the foreground color.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants