In the grid I have to select multiple cells in same column only. Should not allow user to select the cells from difference columns.
I have tried below code.
Private Sub grdTransactions_InitializeLayout(ByVal sender As Object, _
ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) _
Handles grdTransactions.InitializeLayout
e.Layout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect
End Sub
Private Sub grdTransactions_AfterSelectChange(sender As Object, _
e As AfterSelectChangeEventArgs) Handles grdTransactions.AfterSelectChange
Me.grdTransactions.DisplayLayout.Override.SelectTypeCell = UltraWinGrid.SelectType.Single
Me.grdTransactions.DisplayLayout.Override.SelectTypeCol = UltraWinGrid.SelectType.Single
Me.grdTransactions.DisplayLayout.Bands(0).Override.SelectTypeCell = UltraWinGrid.SelectType.Extended
Me.grdTransactions.DisplayLayout.Bands(0).Override.SelectTypeCol = UltraWinGrid.SelectType.Single
Me.grdTransactions.DisplayLayout.Bands(0).Override.MultiCellSelectionMode = MultiCellSelectionMode.Default
Me.grdTransactions.DisplayLayout.Bands(0).Override.MaxSelectedCells = 100
End Sub
The above code allow select cell from difference column. Tell me where I am wrong?
Maybe one possible approach to solve this task, could be if you are using ultraGrid1_BeforeSelectChange() event. For example:
private void ultraGrid1_BeforeSelectChange(object sender, Infragistics.Win.UltraWinGrid.BeforeSelectChangeEventArgs e)
{
if (e.NewSelections.Cells.OfType<UltraGridCell>().First().Column.Key != e.NewSelections.Cells.OfType<UltraGridCell>().Last().Column.Key)
{
e.Cancel = true;
}
}