Font-Awesome-WPF icon indicating copy to clipboard operation
Font-Awesome-WPF copied to clipboard

Conditional Icon Binding on DataGrid

Open james-poulose opened this issue 3 years ago • 0 comments

I am trying to conditionally display icons using the below code.

<DataGridTemplateColumn Header="Level">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <fa:FontAwesome Icon="Warning"></fa:FontAwesome>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=IsError}" Value="True">
                    <Setter Property="Icon" Value="Stop" />
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

I am not even able to compile this due to the error The member "Icon" is not recognized or is not accessible.

Can someone suggest a way to do this?

james-poulose avatar Sep 10 '21 15:09 james-poulose