charri / Font-Awesome-WPF

FontAwesome controls for WPF+UWP
MIT License
533 stars 145 forks source link

Conditional Icon Binding on DataGrid #66

Open james-poulose opened 3 years ago

james-poulose commented 3 years ago

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?