Version

CurrentState Property (UltraWeekView)

Gets the current state of the control (read-only)
Syntax
'Declaration
 
Public ReadOnly Property CurrentState As UltraWeekViewState
public UltraWeekViewState CurrentState {get;}
Remarks

The CurrentState property is used by the control's PerformAction(UltraWeekViewAction,Boolean,Boolean) method as well as its KeyActionMappings table.

The PerformAction(UltraWeekViewAction,Boolean,Boolean) method is useful for programmatically simulating user interaction with the control.

When the user interacts with the control, there are certain conditions that the control must meet before the action can be performed. For example, an item that is disabled cannot be selected. The CurrentState property is the mechanism used by the control to determine whether a certain action can be performed given the current state of the control.

The KeyActionMappings table is the mechanism used by the control to handle all user keyboard interactivity. All keystrokes that have significance to the control are "registered" in the KeyActionMappings table. This table works in conjunction with the PerformAction(UltraWeekViewAction,Boolean,Boolean) method to handle all keystrokes received by the control.

Example
This example displays information about the control's current state in a message box.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports Infragistics.Win.UltraWinSchedule.WeekView

    Private Sub GetCurrentState()

        '--------------------------------------------------------------------------------
        '	CurrentState
        '
        '	This example displays information about the control's current state
        '	in a message box.
        '--------------------------------------------------------------------------------

        Dim info As String = "The control is in the following state(s):" + vbCrLf + vbCrLf

        '	The CurrentState property is expressed in terms of bit flags,
        '	since the control can be in more than one distinct state at any
        '	given time. We will strip each bit that is set until we are left with
        '	no set bits, recording the corresponding state value with each iteration.
        Dim state As Long = Me.ultraWeekView.CurrentState
        Dim mask As Long = 1
        While (state > 0)
            '	See if the bit that corresponds to the current value of the mask
            '	is set if it is, get the name of the enumeration for that state
            If ((state And mask) <> 0) Then
                Dim comboState As UltraWeekViewState = mask
                info += comboState.ToString() + vbCrLf

                '	Strip out the bit so we know when to exit this while loop
                state = state And (Not mask)

            End If

            '	Multiply the mask by 2 to set it to the next power of 2,
            '	effectively shifting the bit position we are checking one
            '	place to the right
            mask *= 2
        End While

        '	Display the state information in a message box
        MessageBox.Show(info, "GetCurrentState", MessageBoxButtons.OK)

    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using Infragistics.Win.UltraWinSchedule.WeekView;
using System.Diagnostics;

		private void GetCurrentState()
		{

			//--------------------------------------------------------------------------------
			//	CurrentState
			//
			//	This example displays information about the control's current state
			//	in a message box.
			//--------------------------------------------------------------------------------

			string info = "The control is in the following state(s):" + "\n" + "\n";

			//	The CurrentState property is expressed in terms of bit flags,
			//	since the control can be in more than one distinct state at any
			//	given time. We will strip each bit that is set until we are left with
			//	no set bits, recording the corresponding state value with each iteration.
			long state = (long)this.ultraWeekView.CurrentState;
			long mask = 1;
			while ( state > 0 )
			{
				//	See if the bit that corresponds to the current value of the mask
				//	is set; if it is, get the name of the enumeration for that state
				if ( ( state & mask ) != 0 )
				{
					UltraWeekViewState comboState = (UltraWeekViewState)( mask );
					info += comboState.ToString() + "\n";

					//	Strip out the bit so we know when to exit this while loop
					state &= ~mask;
				}

				//	Multiply the mask by 2 to set it to the next power of 2,
				//	effectively shifting the bit position we are checking one
				//	place to the right
				mask *= 2;
			}

			//	Display the state information in a message box
			MessageBox.Show( info, "GetCurrentState", MessageBoxButtons.OK );

		}
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