Ranjit Menon

Ranjit Menon

  • NA
  • 8
  • 7.4k

Datagrid checkbox binding issue

Apr 8 2014 12:23 PM
I have bound the datagrid checkbox column with the property of the dataobject. The value of the property for example is Land,Sea ,Air etc. I need to set the checkbox to checked if it is land. How do I do it. My current code is as follows

<DataGrid.Columns>
<DataGridTextColumn Header="Type" Binding="{Binding Path=Vehicle}" />
<DataGridTextColumn Header="Make" Binding="{Binding Path=Vehicle.Make}" />
<DataGridTextColumn Header="Model" Binding="{Binding Path=Vehicle.Model}" />
<DataGridTextColumn Header="No of Wheels" Binding="{Binding Path=Vehicle.NumberOfWheels}"/>
<DataGridTemplateColumn Header="Road Vechile">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=Vehicle.Environment,Mode=OneWay }"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>

Answers (2)