Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
Icon in a field
posted

Is there a simple way to display an icon in a DataGrid field according to a Boolean value?

Granted, a converter is required to convert a Boolean to Visibility but can you show an example of the required xaml.

For example, here is what I do for a simple GridView:

<GridViewColumn Width="30" Header="MyHeader" >
  <GridViewColumn.CellTemplate>
    <DataTemplate>
      <Image Source="/MyProject;component/Resources/Document.png" Width="16" Height="16" Margin="1" Visibility="{Binding IsVisible, Converter={StaticResource booleanToVisibleCollapsedConverter}}" />
    </DataTemplate>
  </GridViewColumn.CellTemplate>
</GridViewColumn>