Version

BeforeActiveOwnerChanged Event (UltraDayView)

Event fired before the active owner has been changed.
Syntax
'Declaration
 
Public Event BeforeActiveOwnerChanged As BeforeActiveOwnerChangedEventHandler
public event BeforeActiveOwnerChangedEventHandler BeforeActiveOwnerChanged
Event Data

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

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
ClearSelectedActivities Gets/sets whether the SelectedAppointments, SelectedHolidays and (for UltraMonthViewSingleBase derived controls only) SelectedNotes collections should be cleared.
NewActiveOwner Returns the new active owner.
Remarks

This event is fired before the ActiveOwner has changed.

The operation can be canceled from within this event by setting the event args Cancel parameter to true.

Example
The following code sample demonstrates how to use the BeforeActiveOwnerChanged event to prevent a particular owner from becoming activated, and how to use the AfterActiveOwnerChanged event to synchronize the active owner across different controls.

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_BeforeActiveOwnerChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeActiveOwnerChangedEventArgs) Handles UltraDayView1.BeforeActiveOwnerChanged

        '	If the new ActiveOwner is the unassigned owner, cancel
        '	 the event to disallow the unassigned owner from becoming
        '	activated.
        If e.NewActiveOwner.IsUnassigned Then
            e.Cancel = True
        End If

    End Sub

    Private Sub UltraWeekView1_BeforeActiveOwnerChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeActiveOwnerChangedEventArgs) Handles UltraWeekView1.BeforeActiveOwnerChanged

        '	If the new ActiveOwner is the unassigned owner, cancel
        '	 the event to disallow the unassigned owner from becoming
        '	activated.
        If e.NewActiveOwner.IsUnassigned Then
            e.Cancel = True
        End If

    End Sub

    Private Sub UltraWeekView1_AfterActiveOwnerChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.AfterActiveOwnerChangedEventArgs) Handles UltraWeekView1.AfterActiveOwnerChanged

        '	Synchronize the UltraWeekView's ActiveOwner when the
        '	ActiveOwner changes in the UltraDayView control
        If Not Me.UltraDayView1.ActiveOwner Is e.NewActiveOwner Then
            Me.UltraDayView1.ActiveOwner = e.NewActiveOwner
        End If

    End Sub

    Private Sub UltraDayView1_AfterActiveOwnerChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.AfterActiveOwnerChangedEventArgs) Handles UltraDayView1.AfterActiveOwnerChanged

        '	Synchronize the UltraWeekView's ActiveOwner when the
        '	ActiveOwner changes in the UltraDayView control
        If Not Me.ultraWeekView1.ActiveOwner Is e.NewActiveOwner Then
            Me.ultraWeekView1.ActiveOwner = e.NewActiveOwner
        End If

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

		private void ultraDayView1_BeforeActiveOwnerChanged(object sender, Infragistics.Win.UltraWinSchedule.BeforeActiveOwnerChangedEventArgs e)
		{
			//	If the new ActiveOwner is the unassigned owner, cancel
			//	 the event to disallow the unassigned owner from becoming
			//	activated.
			if ( e.NewActiveOwner.IsUnassigned )
				e.Cancel = true;
		}

		private void ultraWeekView1_BeforeActiveOwnerChanged(object sender, Infragistics.Win.UltraWinSchedule.BeforeActiveOwnerChangedEventArgs e)
		{		
			//	If the new ActiveOwner is the unassigned owner, cancel
			//	 the event to disallow the unassigned owner from becoming
			//	activated.
			if ( e.NewActiveOwner.IsUnassigned )
				e.Cancel = true;
		}

		private void ultraDayView1_AfterActiveOwnerChanged(object sender, Infragistics.Win.UltraWinSchedule.AfterActiveOwnerChangedEventArgs e)
		{
			//	Synchronize the UltraWeekView's ActiveOwner when the
			//	ActiveOwner changes in the UltraDayView control
			if ( this.ultraWeekView1.ActiveOwner != e.NewActiveOwner )
				this.ultraWeekView1.ActiveOwner = e.NewActiveOwner;		
		}

		private void ultraWeekView1_AfterActiveOwnerChanged(object sender, Infragistics.Win.UltraWinSchedule.AfterActiveOwnerChangedEventArgs e)
		{
			//	Synchronize the UltraDayView's ActiveOwner when the
			//	ActiveOwner changes in the UltraWeekView control
			if ( this.ultraDayView1.ActiveOwner != e.NewActiveOwner )
				this.ultraDayView1.ActiveOwner = e.NewActiveOwner;
		}
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