Hello,
I don't want to allow user to select a non-rectangular area when selecting multiple cells (CTRL+Clicks), allowing him only to select a rectangular area. Is there a workaround for this?
Thank you.
A possible workaround would be to add event handler for SelectedCellsCollectionChanged event , check if the Ctrl key is pressed, and if this case, restore the previous selection state:
XAML Code:
<ig:XamGrid x:Name="igGrid"
SelectedCellsCollectionChanged="igGrid_SelectedCellsCollectionChanged">
<ig:XamGrid.SelectionSettings>
<ig:SelectionSettings CellSelection="Multiple" />
</ig:XamGrid.SelectionSettings>
</ig:XamGrid>
C# Code:
private void igGrid_SelectedCellsCollectionChanged(object sender, SelectionCollectionChangedEventArgs<SelectedCellsCollection> e)
{
if ((Keyboard.Modifiers & ModifierKeys.Control) > 0)
igGrid.SelectedCellsCollectionChanged -= igGrid_SelectedCellsCollectionChanged;
igGrid.SelectionSettings.SelectedCells.Clear();
igGrid.SelectionSettings.SelectedCells.AddRange(e.PreviouslySelectedItems);
igGrid.SelectedCellsCollectionChanged += igGrid_SelectedCellsCollectionChanged;
}
Hope that helps,
Thank you very much. This works fine.