'Declaration Public Property SelectionStrategyFilter As Infragistics.Win.ISelectionStrategyFilter
public Infragistics.Win.ISelectionStrategyFilter SelectionStrategyFilter {get; set;}
You can specify what type of selection is allowed for various types of objects by using the properties of the UltraGridOverride object. The properties UltraGridOverride.SelectTypeCell, UltraGridOverride.SelectTypeCol, UltraGridOverride.SelectTypeGroupByRow and UltraGridOverride.SelectTypeRow are used to specify a selection strategy for the corresponding type of object.
UltraWinGrid uses selection strategies to control the types of selection the user can perform in the control. A selection strategy is an extended set of attributes covering options such as multiple vs. single selection, range vs. discrete selection, non-contiguous selection, what types of objects may be selected and how selection is initiated and completed using the keyboard and mouse. Selection strategies are implemented using the SelectionManager object and the ISelectionFilter interface. Selection strategies are defined in the Infragistics.Win assembly.
UltraWinGrid includes pre-defined strategies for the most common types of selection that are performed in a grid. You can also create your own selection strategies by deriving your own selection filter classes from those supplied and overriding selected virtual methods.
Since selection is primarily a function of the user interface, selection logic is based off of the UIElement for an object. The Selectable property of the UIElement determines whether the object can be selected.
The following table lists the default key mappings for the UltraGrid control:
KeyCode | ActionCode | StateRequired | StateDisallowed | SpecialKeysRequired | SpecialKeysDisallowed |
---|---|---|---|---|---|
Right | NextCell | Cell | InEdit | None | AltCtrl |
Tab | NextCellByTab | Cell | None | None | All |
Left | PrevCell | Cell | InEdit | None | AltCtrl |
Tab | PrevCellByTab | Cell | None | Shift | AltCtrl |
Up | AboveCell | Cell | InEdit | None | Alt |
Down | BelowCell | Cell | InEdit | None | Alt |
Home | FirstRowInBand | Row | Cell | None | AltCtrl |
End | LastRowInBand | Row | Cell | None | AltCtrl |
Right | FirstRowInGrid | None | Row | None | Alt |
Down | FirstRowInGrid | None | Row | None | Alt |
Home | FirstRowInGrid | Row | Cell | Ctrl | Alt |
End | LastRowInGrid | Row | Cell | Ctrl | Alt |
Right | ExpandRow | RowExpandable | Cell, RowExpanded | None | Alt |
Left | CollapseRow | RowExpanded | Cell | None | Alt |
Right | NextRow | Row | Cell, RowExpandable | None | Alt |
Right | NextRow | Row, RowExpanded | Cell | None | Alt |
Tab | NextRowByTab | Row | Cell | None | All |
Left | PrevRow | Row | Cell, RowExpanded | None | Alt |
Tab | PrevRowByTab | Row | Cell | Shift | AltCtrl |
Up | AboveRow | Row | Cell | None | Alt |
Down | BelowRow | Row | Cell | None | Alt |
Space | ToggleCheckbox | InEdit, IsCheckbox | None | None | All |
Space | ToggleCellSel | Cell | InEdit | None | All |
Space | ToggleRowSel | Row | Cell | None | All |
Space | DeactivateCell | Cell | None | Ctrl | AltShift |
Space | ActivateCell | Row | Cell | Ctrl | AltShift |
Right | NextCellInBand | Cell | InEdit | Ctrl | Alt |
Left | PrevCellInBand | Cell | InEdit | Ctrl | Alt |
Home | FirstCellInRow | Cell | CellFirst, InEdit | None | AltCtrl |
End | LastCellInRow | Cell | CellLast, InEdit | None | AltCtrl |
Home | FirstCellInBand | CellFirst | InEdit | None | AltCtrl |
End | LastCellInBand | CellLast | InEdit | None | AltCtrl |
Home | FirstCellInGrid | Cell | InEdit | Ctrl | Alt |
End | LastCellInGrid | Cell | InEdit | Ctrl | Alt |
Prior | PageUpCell | Cell | InEdit | None | Alt |
Next | PageDownCell | Cell | InEdit | None | Alt |
Prior | PageUpRow | Row | Cell | None | Alt |
Next | PageDownRow | Row | Cell | None | Alt |
Escape | UndoCell | InEdit | IsDroppedDown | None | Alt |
Escape | UndoRow | Row | InEdit | None | Alt |
Escape | CloseDropdown | IsDroppedDown | None | None | Alt |
Enter | CloseDropdown | IsDroppedDown | None | None | Alt |
Enter | ExpandRow | GroupByRow | IsDroppedDown, RowExpanded | None | Alt |
Enter | CollapseRow | RowExpanded, GroupByRow | IsDroppedDown | None | Alt |
F4 | ToggleDropdown | HasDropdown, InEdit | None | None | Alt |
Up | ToggleDropdown | HasDropdown, InEdit | None | Alt | None |
Down | ToggleDropdown | HasDropdown, InEdit | None | Alt | None |
F2 | ToggleEditMode | Cell | None | None | Alt |
F4 | EnterEditModeAndDropdown | HasDropdown | InEdit | None | Alt |
Up | EnterEditModeAndDropdown | HasDropdown | InEdit | Alt | None |
Down | EnterEditModeAndDropdown | HasDropdown | InEdit | Alt | None |
F6 | NextRegion | None | InEdit | None | All |
F6 | PrevRegion | None | InEdit | Shift | AltCtrl |
Delete | DeleteRows | Row | InEdit | None | All |
F2 | EnterEditMode | Cell | InEdit | None | Alt |
F2 | ExitEditMode | InEdit | None | None | Alt |
The following sample code illustrates how to supply a custom selection strategy for cells in an UltraGridControl.
Note: this is not usually necessary. Normally, the selection strategy for cells is based on the setting of the 'SelectTypeCell' property of the UltraGridOverride object.
Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid ' Implement the ISelectionStrategyFilter interface on a class ' (in this case the form) Public Class Form1 Inherits System.Windows.Forms.Form Implements Infragistics.Win.ISelectionStrategyFilter Private cellSelectionStrategy As MyCustomSelectionStrategy Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Create the custom selection strategy Me.cellSelectionStrategy = New MyCustomSelectionStrategy(Me.UltraGrid1) ' Set the grid’s SelectionStrategyFilter property to the object that ' implements the ISelectionStrategyFilter interface. Me.UltraGrid1.SelectionStrategyFilter = Me End Sub Public Function GetSelectionStrategy(ByVal item As Infragistics.Shared.ISelectableItem) As Infragistics.Win.ISelectionStrategy Implements Infragistics.Win.ISelectionStrategyFilter.GetSelectionStrategy ' If the item is a cell return the custom strategy If TypeOf (item) Is UltraGridCell Then Return Me.cellSelectionStrategy End If ' Return null to have the grid provide an appropriate strategy Return Nothing End Function End Class ' derive a class from one of the selection ' strategies defines in the PLF Friend Class MyCustomSelectionStrategy Inherits Infragistics.Win.SelectionStrategyExtended Public Sub New(ByVal manager As ISelectionManager) MyBase.New(manager) End Sub Public Overloads Overrides Function OnMouseDown(ByVal item As Infragistics.Shared.ISelectableItem, ByRef msginfo As Infragistics.Win.MouseMessageInfo) As Boolean ' Do some custom mouse down processing ' ... Return MyBase.OnMouseDown(item, msginfo) End Function End Class
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; // Implement the ISelectionStrategyFilter interface on a class // (in this case the form) public class Form1 : System.Windows.Forms.Form, Infragistics.Win.ISelectionStrategyFilter { private ISelectionStrategy cellSelectionStrategy; private void Form1_Load(object sender, System.EventArgs e) { // Set the grid’s SelectionStrategyFilter property to the object that // implements the ISelectionStrategyFilter interface. this.ultraGrid1.SelectionStrategyFilter = this; // Create the custom selection strategy this.cellSelectionStrategy = new MyCustomSelectionStrategy( this.ultraGrid1 ); } public Infragistics.Win.ISelectionStrategy GetSelectionStrategy(Infragistics.Shared.ISelectableItem item) { // If the item is a cell return the custom strategy if ( item is UltraGridCell ) return this.cellSelectionStrategy; return null; } // derive a class from one of the selection // strategies defines in the PLF internal class MyCustomSelectionStrategy : SelectionStrategyExtended { internal MyCustomSelectionStrategy( ISelectionManager manager ) : base( manager ) { } public override bool OnMouseDown(Infragistics.Shared.ISelectableItem item, ref Infragistics.Win.MouseMessageInfo msginfo) { // Do some custom mouse down processing // ... return base.OnMouseDown( item, ref msginfo ); } } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2