1

I have this column in my datagrid

<DataGridTemplateColumn Header="Delete" IsReadOnly="True" >
    <DataGridTemplateColumn.CellStyle>
     <Style TargetType="DataGridCell">
       <Setter Property="Background" Value="Transparent"/>
       <Setter Property="BorderBrush" Value="Transparent"/> 
      </Style>
       <DataGridTemplateColumn.CellStyle>
        <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
        <CheckBox IsChecked="{Binding Delete, UpdateSourceTrigger=PropertyChanged, 
         Mode=TwoWay}" />
         </DataTemplate>
      </DataGridTemplateColumn.CellTemplate>
 </DataGridTemplateColumn>

I want to disable the selection of this column since, if the user clicks on this column, other cells on its row get selected too. Therefore, I want to disable this column selection but the allow the checkbox to remain enabled.

Ben Hoffstein
  • 102,129
  • 8
  • 104
  • 120
Nivid Dholakia
  • 5,272
  • 4
  • 30
  • 55

1 Answers1

1

for the data grid change it so its

<DataGrid SelectionUnit="CellOrRowHeader">

that should allow you to select individual cells

Manatherin
  • 4,169
  • 5
  • 36
  • 52
  • It worked but i had to modify the event trigger on the datagrid and then getting the header of the row from the collection if its "Delete" i would not set the selected item. – Nivid Dholakia Jul 07 '11 at 16:20