Version

CurrentState Property (UltraListView)

Returns a UltraListViewStates value which represents the current state of the UltraListView control
Syntax
'Declaration
 
Public ReadOnly Property CurrentState As UltraListViewStates
public UltraListViewStates CurrentState {get;}
Example
The following code sample demonstrates how the UltraListView's KeyActionMappings collection can be used to modify the default keyboard for the control. In this example, the default mappings for the 'Home' and 'End' keys are removed, and replaced with mappings which navigate to the first/last item on an iconic row. The default mappings for 'Home' and 'End' are then remapped to require the Control key, so that the Ctrl+Home/Ctrl+End key combinations navigate to the first/last item displayed by the control, respectively:

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView

    Private Sub ModifyHomeEndKeyMappings()

        '	The custom key mappings only apply to the iconic views, and multi-column list view
        If (Me.ultraListView1.CurrentState And UltraListViewStates.SupportsHorizontalItemNavigation) = UltraListViewStates.SupportsHorizontalItemNavigation Then

            '	Iterate the KeyActionMappings collection, and remove all mappings for
            '	the 'Home' and 'End' keys
            Dim keyMappings As UltraListViewKeyActionMappings = Me.ultraListView1.KeyActionMappings
            Dim keyMapping As UltraListViewKeyActionMapping = Nothing

            Dim i As Integer
            For i = keyMappings.Count - 1 To 0 Step -1

                keyMapping = keyMappings(i)
                If (keyMapping.KeyCode = Keys.Home Or keyMapping.KeyCode = Keys.End) Then
                    keyMappings.Remove(keyMapping)
                End If

            Next

            '	Add a new UltraListViewKeyActionMapping for the Home key which uses the
            '	'ActivateFirstInIconRow' action, so that pressing the Home key navigates
            '	to the first item on the same row as the ActiveItem.
            keyMapping = New UltraListViewKeyActionMapping(Keys.Home, _
                        UltraListViewAction.ActivateFirstInIconRow, _
                        UltraListViewStates.ItemInEditMode, _
                        UltraListViewStates.SupportsHorizontalItemNavigation, _
                        SpecialKeys.All, _
                        0)

            keyMappings.Add(keyMapping)

            '	Add a new UltraListViewKeyActionMapping for the End key which uses the
            '	'ActivateLastInIconRow' action, so that pressing the End key navigates
            '	to the last item on the same row as the ActiveItem.
            keyMapping = New UltraListViewKeyActionMapping(Keys.End, _
                        UltraListViewAction.ActivateLastInIconRow, _
                        UltraListViewStates.ItemInEditMode, _
                        UltraListViewStates.SupportsHorizontalItemNavigation, _
                        SpecialKeys.All, _
                        0)

            keyMappings.Add(keyMapping)

            '	Now add a new UltraListViewKeyActionMapping for the Home key which uses the
            '	'ActivateFirst' action, and requires the Control key, so that pressing
            '	Ctrl+Home navigates to the first item displayed by the control.
            keyMapping = New UltraListViewKeyActionMapping(Keys.Home, _
                        UltraListViewAction.ActivateFirst, _
                        UltraListViewStates.ItemInEditMode, _
                        UltraListViewStates.SupportsHorizontalItemNavigation, _
                        0, _
                        SpecialKeys.Ctrl)

            keyMappings.Add(keyMapping)

            '	Now add a new UltraListViewKeyActionMapping for the End key which uses the
            '	'ActivateLast' action, and requires the Control key, so that pressing
            '	Ctrl+End navigates to the last item displayed by the control.
            keyMapping = New UltraListViewKeyActionMapping(Keys.End, _
                        UltraListViewAction.ActivateLast, _
                        UltraListViewStates.ItemInEditMode, _
                        UltraListViewStates.SupportsHorizontalItemNavigation, _
                        0, _
                        SpecialKeys.Ctrl)

            keyMappings.Add(keyMapping)
        End If
    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;
using System.Diagnostics;

		private void ModifyHomeEndKeyMappings()
		{
			//	The custom key mappings only apply to the iconic views, and multi-column list view
			if ( (this.ultraListView1.CurrentState & UltraListViewStates.SupportsHorizontalItemNavigation) == UltraListViewStates.SupportsHorizontalItemNavigation )
			{
				//	Iterate the KeyActionMappings collection, and remove all mappings for
				//	the 'Home' and 'End' keys
				UltraListViewKeyActionMappings keyMappings = this.ultraListView1.KeyActionMappings;
				UltraListViewKeyActionMapping keyMapping = null;
				for ( int i = keyMappings.Count - 1; i >= 0; i-- )
				{
					keyMapping = keyMappings[i];
					if ( keyMapping.KeyCode == Keys.Home || keyMapping.KeyCode == Keys.End )
						keyMappings.Remove( keyMapping );
				}

				//	Add a new UltraListViewKeyActionMapping for the Home key which uses the
				//	'ActivateFirstInIconRow' action, so that pressing the Home key navigates
				//	to the first item on the same row as the ActiveItem.
				keyMapping = new UltraListViewKeyActionMapping( Keys.Home,
																UltraListViewAction.ActivateFirstInIconRow,
																UltraListViewStates.ItemInEditMode,
																UltraListViewStates.SupportsHorizontalItemNavigation,
																SpecialKeys.All,
																0 );

				keyMappings.Add( keyMapping );

				//	Add a new UltraListViewKeyActionMapping for the End key which uses the
				//	'ActivateLastInIconRow' action, so that pressing the End key navigates
				//	to the last item on the same row as the ActiveItem.
				keyMapping = new UltraListViewKeyActionMapping( Keys.End,
																UltraListViewAction.ActivateLastInIconRow,
																UltraListViewStates.ItemInEditMode,
																UltraListViewStates.SupportsHorizontalItemNavigation,
																SpecialKeys.All,
																0 );

				keyMappings.Add( keyMapping );

				//	Now add a new UltraListViewKeyActionMapping for the Home key which uses the
				//	'ActivateFirst' action, and requires the Control key, so that pressing
				//	Ctrl+Home navigates to the first item displayed by the control.
				keyMapping = new UltraListViewKeyActionMapping( Keys.Home,
																UltraListViewAction.ActivateFirst,
																UltraListViewStates.ItemInEditMode,
																UltraListViewStates.SupportsHorizontalItemNavigation,
																0,
																SpecialKeys.Ctrl );

				keyMappings.Add( keyMapping );

				//	Now add a new UltraListViewKeyActionMapping for the End key which uses the
				//	'ActivateLast' action, and requires the Control key, so that pressing
				//	Ctrl+End navigates to the last item displayed by the control.
				keyMapping = new UltraListViewKeyActionMapping( Keys.End,
																UltraListViewAction.ActivateLast,
																UltraListViewStates.ItemInEditMode,
																UltraListViewStates.SupportsHorizontalItemNavigation,
																0,
																SpecialKeys.Ctrl );

				keyMappings.Add( keyMapping );
			}
		}
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