views:

16

answers:

0

I am trying to work out a way to achieve the following cell selection constraints:

  1. Only allow multiple cells from the same row to be selected
  2. Only allow contiguous cells to be selected
  3. Do not allows cells in column 1 to be selected

So far I have looked at SelectedCellsChanged event but that does not seem to want to let me change the add/removed cells. Even if I could its not very MVVM friendly.

If I want to use CellStyles e.g.

<DataGrid.CellStyle>
                <Style TargetType="DataGridCell">
                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}" />

That wont work because the data context for a cell is the row, not the property. So this only tells me if the row is selected. To do something clever in my view models I need to know if the "property" cell is selected and I can't yet see how that can be done.

Any thoughts?