Version

BeforePerformAction Event (UltraDayView)

Event fired before an action associated with a key action mapping is about to be performed.
Syntax
'Declaration
 
Public Event BeforePerformAction As BeforeDayViewPerformActionEventHandler
public event BeforeDayViewPerformActionEventHandler BeforePerformAction
Event Data

The event handler receives an argument of type BeforeDayViewPerformActionEventArgs containing data related to this event. The following BeforeDayViewPerformActionEventArgs properties provide information specific to this event.

PropertyDescription
Action The action that is about to be performed.
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Remarks

BeforePerformAction event gets fired before an action associated with a key action mapping is about to be performed. It is a cancelable event. When it's cancelled, UltraDayView will not perform the action for which this event was fired.

Example
The following code sample demonstrates how the BeforePerformAction event can be used to prevent a particular action from being performed, and how to use the AfterPerformAction event to alert the end user after a particular action is performed.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule

    Private Sub UltraDayView1_BeforePerformAction(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeDayViewPerformActionEventArgs) Handles UltraDayView1.BeforePerformAction
        '	Cancel the event if the action is 'DeleteSelectedAppointments', to
        '	prevent the end user from deleting appointments via the keyboard.
        If e.Action = UltraDayViewAction.DeleteSelectedAppointments Then
            e.Cancel = True
        End If

    End Sub

    Private Sub UltraDayView1_AfterPerformAction(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.AfterDayViewPerformActionEventArgs) Handles UltraDayView1.AfterPerformAction
        '   Make the system 'beep' sound if the end user cancels edit mode
        If e.Action = UltraDayViewAction.EndCurrentEditDiscardChanges Then
            Beep()
        End If

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

		private void ultraDayView1_BeforePerformAction(object sender, Infragistics.Win.UltraWinSchedule.BeforeDayViewPerformActionEventArgs e)
		{
			//	Cancel the event if the action is 'DeleteSelectedAppointments', to
			//	prevent the end user from deleting appointments via the keyboard.
			if ( e.Action == UltraDayViewAction.DeleteSelectedAppointments )
				e.Cancel = true;
		}

		private void ultraDayView1_AfterPerformAction(object sender, Infragistics.Win.UltraWinSchedule.AfterDayViewPerformActionEventArgs e)
		{
			//   Make the system 'beep' sound if the end user cancels edit mode
			if ( e.Action == UltraDayViewAction.EndCurrentEditDiscardChanges )
			{
				//	Note: requires a reference to the Microsoft.VisualBasic assembly
				Microsoft.VisualBasic.Interaction.Beep();
			}
		}
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