The following code sample demonstrates how to use the IsOwnerInView method to determine whether a particular owner is currently being displayed by the control, and how to use the EnsureOwnerInView method to bring a particular owner into view.
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Clear the Owners collection
Me.ultraWeekView1.CalendarInfo.Owners.Clear()
' Hide the unassigned owner
Me.ultraWeekView1.CalendarInfo.Owners.UnassignedOwner.Visible = False
' Clear the Owners collection
Me.ultraWeekView1.CalendarInfo.Owners.Clear()
' Hide the unassigned owner
Me.ultraWeekView1.CalendarInfo.Owners.UnassignedOwner.Visible = False
' Add some owners
Dim i As Int32
For i = 0 To 9
Me.ultraWeekView1.CalendarInfo.Owners.Add("ID_" + i.ToString(), "Owner " + i.ToString())
Next i
' Set the OwnerDisplayStyle property to 'Separate' so that
' owners are displayed separately
Me.ultraWeekView1.OwnerDisplayStyle = OwnerDisplayStyle.Separate
' Set the OwnerNavigationStyle property to Scrollbar so the end user
' can navigate through owners with a horizontal scrollbar
Me.ultraWeekView1.OwnerNavigationStyle = OwnerNavigationStyle.Scrollbar
' Set the MaximumOwnersInView property to 2 so the end user can view
' up to 2 owners at a time
Me.ultraWeekView1.MaximumOwnersInView = 2
' Get a reference to the last owner in the collection
Dim lastOwner As Infragistics.Win.UltraWinSchedule.Owner = Me.ultraWeekView1.CalendarInfo.Owners(Me.ultraWeekView1.CalendarInfo.Owners.Count - 1)
' Use the 'IsOwnerInView' method to determine whether the last owner is in view
Dim isInView As Boolean = Me.ultraWeekView1.IsOwnerInView(lastOwner)
' If the owner is not in view, use the EnsureOwnerInView method to bring it into view.
If isInView = False Then
Me.ultraWeekView1.EnsureOwnerInView(lastOwner, False)
End If
End Sub
'Declaration
Public Sub EnsureOwnerInView( _
ByVal As Owner, _
ByVal As Boolean _
)
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;
private void button1_Click(object sender, System.EventArgs e)
{
// Clear the Owners collection
this.ultraWeekView1.CalendarInfo.Owners.Clear();
// Hide the unassigned owner
this.ultraWeekView1.CalendarInfo.Owners.UnassignedOwner.Visible = false;
// Add some owners
for ( int i = 0; i < 10; i ++ )
{
this.ultraWeekView1.CalendarInfo.Owners.Add( "ID_" + i.ToString(), "Owner " + i.ToString() );
}
// Set the OwnerDisplayStyle property to 'Separate' so that
// owners are displayed separately
this.ultraWeekView1.OwnerDisplayStyle = OwnerDisplayStyle.Separate;
// Set the OwnerNavigationStyle property to Scrollbar so the end user
// can navigate through owners with a horizontal scrollbar
this.ultraWeekView1.OwnerNavigationStyle = OwnerNavigationStyle.Scrollbar;
// Set the MaximumOwnersInView property to 2 so the end user can view
// up to 2 owners at a time
this.ultraWeekView1.MaximumOwnersInView = 2;
// Get a reference to the last owner in the collection
Infragistics.Win.UltraWinSchedule.Owner lastOwner = this.ultraWeekView1.CalendarInfo.Owners[this.ultraWeekView1.CalendarInfo.Owners.Count - 1];
// Use the 'IsOwnerInView' method to determine whether the last owner is in view
bool isInView = this.ultraWeekView1.IsOwnerInView( lastOwner );
// If the owner is not in view, use the EnsureOwnerInView method to bring it into view.
if ( isInView == false )
this.ultraWeekView1.EnsureOwnerInView( lastOwner, false );
}
'Declaration
Public Sub EnsureOwnerInView( _
ByVal As Owner, _
ByVal As Boolean _
)
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