I’ve run into a bit of a problem. I’ve created a DataTemplate and put it into App.xaml and I’d like to use it to style my CheckBoxes within a dozen or so ListViews I have. The particular ListViews each have at least one column with a bool value.
Here’s the DataTemplate I made:
<DataTemplate x:Key="checkBoxDataTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" Grid.Row="0" Style="{StaticResource DataGridCheckBox}" IsChecked="{WhatDoIPutHere?}" />
</Grid>
</DataTemplate>
And I’m trying to use it to replace this:
<GridViewColumn Header="Discovery Date">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox Grid.Column="0" Grid.Row="0" Style="{StaticResource DataGridCheckBox}" IsChecked="{Binding CaseProperty.DiscoveryDate, Mode=OneWay, Converter={StaticResource booleanConverter},ConverterParameter='datetime'}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
As you can see, I have IsChecked bound to a specific property of an object attached to my ListView. If I replace it with my template, how do I bind to the IsChecked property of CheckBox in the DataTemplate?
Thanks in advance,
Sonny
I’ve since abandoned this approach. I don’t think DataTemplates are designed to work in this way… oh well…