Version

Remove(Int32) Method

Removes a mapping from the collection
Syntax
'Declaration
 
Public Overloads Sub Remove( _
   ByVal index As Integer _
) 
public void Remove( 
   int index
)

Parameters

index
The index of the mapping to remove
Example
This sample checks to see if the specified key is mapped. If it is mapped, the mapping is removed prior to re-mapping the key

Imports Infragistics.Win

	
Private Sub SetKeyMappings()

      ' Maps the W and Z keys to traverse the grid up and down when not in edit mode.
      MapKey(Keys.Z, UltraWinGrid.UltraGridAction.NextRow)
      MapKey(Keys.W, UltraWinGrid.UltraGridAction.PrevRow)

  End Sub

  Private Sub MapKey(ByVal key As System.Windows.Forms.Keys, ByVal action As UltraWinGrid.UltraGridAction)

      If Me.UltraGrid1.KeyActionMappings.IsKeyMapped(key, 0) Then
          ' Remove the existing mapping if it exists
          Dim i As Integer

          For i = 0 To Me.UltraGrid1.KeyActionMappings.Count - 1
              If Me.UltraGrid1.KeyActionMappings(i).KeyCode = key Then
                  Me.UltraGrid1.KeyActionMappings.Remove(i)
              End If
          Next i

          Dim ka As UltraWinGrid.GridKeyActionMapping = New UltraWinGrid.GridKeyActionMapping(key, action, UltraWinGrid.UltraGridState.InEdit, 0, 0, 0)
          Me.UltraGrid1.KeyActionMappings.Add(ka)
      Else
          Dim ka As UltraWinGrid.GridKeyActionMapping = New UltraWinGrid.GridKeyActionMapping(key, action,  UltraWinGrid.UltraGridState.InEdit, 0, 0, 0)
          Me.UltraGrid1.KeyActionMappings.Add(ka)
      End If

  End Sub
using Ingragistics.Win;

private void SetKeyMappings()
{

	// Maps the W and Z keys to traverse the grid up and down when not in edit mode.
	MapKey(Keys.Z, UltraWinGrid.UltraGridAction.NextRow);
	MapKey(Keys.W, UltraWinGrid.UltraGridAction.PrevRow );
	
}

private void MapKey(System.Windows.Forms.Keys key, UltraWinGrid.UltraGridAction action)
{

	if (this.ultraGrid1.KeyActionMappings.IsKeyMapped(key,0))
	{
		// Remove the existing mapping if it exists
		for(int i = 0; i < this.ultraGrid1.KeyActionMappings.Count; i++)
		{
			if (this.ultraGrid1.KeyActionMappings[i].KeyCode == key )
			{
				this.ultraGrid1.KeyActionMappings.Remove(i);
				break;
			}
		}
		UltraWinGrid.GridKeyActionMapping ka = new UltraWinGrid.GridKeyActionMapping(key,action,UltraWinGrid.UltraGridState.InEdit ,0,0,0);
		this.ultraGrid1.KeyActionMappings.Add(ka);
	}
	else
	{
		UltraWinGrid.GridKeyActionMapping ka = new UltraWinGrid.GridKeyActionMapping(key,action,UltraWinGrid.UltraGridState.InEdit ,0,0,0);
		this.ultraGrid1.KeyActionMappings.Add(ka);
	}

}
Requirements

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

See Also