|
public MainWindow()
{
InitializeComponet();
this.datagrid.AllowDeleting = true;
this.datagrid.SelctionUnit = Grid SelectionUnit.Any;
}
|
|
public class GridSelectionControllerExt : GridSelectionController
{
public GridSelectionControllerExt(SfDataGrid dataGrid) : base(dataGrid)
{
}
protected override void ProcessKeyDown(KeyEventArgs args)
{
//Customizes the Delete key operation.
if (args.Key == Key.Delete)
{
this.DataGrid.View.Records.RemoveAt(this.DataGrid.SelectedIndex);
}
else
{
base.ProcessKeyDown(args);
}
}
} |
|
public MainWindow()
{
InitializeComponet();
// Assigns the customized GridSelectionControllerExt.
this.dataGrid.SelectionController = new GridSelectionControllerExt(dataGrid);
}
|
|
public MainWindow()
{
InitializeComponet();
this.datagrid.AllowDeleting = true;
this.datagrid.SelctionUnit = Grid SelectionUnit.Any;
this.dataGrid.SelectionController = new GridSelectionControllerExt(dataGrid);
}
|
|
public class GridSelectionControllerExt : GridSelectionController
{
public GridSelectionControllerExt(SfDataGrid dataGrid) : base(dataGrid)
{
}
protected override void ProcessKeyDown(KeyEventArgs args)
{
//Customizes the Delete key operation.
if (args.Key == Key.Delete && (this.DataGrid.SelectionUnit == GridSelectionUnit.Any || this.DataGrid.SelectionUnit == GridSelectionUnit.Cell))
{
this.DataGrid.View.Records.RemoveAt(this.DataGrid.SelectedIndex);
}
else
{
base.ProcessKeyDown(args);
}
}
} |