Version

WeekHeaderDisplayStyle Property

Gets/sets how the week number or date information is displayed in the week header.
Syntax
'Declaration
 
Public Property WeekHeaderDisplayStyle As WeekHeaderDisplayStyle
public WeekHeaderDisplayStyle WeekHeaderDisplayStyle {get; set;}
Example
The following code sample demonstrates how to set the WeekHeaderDisplayStyle property, and how to use the WeekHeaderClicked event.

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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        '	Set the WeekHeaderDisplayStyle property to 'WeekNumber'
        Me.ultraMonthViewSingle1.WeekHeaderDisplayStyle = WeekHeaderDisplayStyle.WeekNumber
    End Sub


    Private Sub ultraMonthViewSingle1_WeekHeaderClicked(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.WeekHeaderClickedEventArgs) Handles ultraMonthViewSingle1.WeekHeaderClicked
        Dim monthViewSingle As UltraMonthViewSingle = sender

        '	Set the 'SelectWeek' property of the event arguments to false
        '	so that the default selection does not take place
        e.SelectWeek = False

        '	Get the first day of the week displayed by the control
        Dim dayOfWeek As System.DayOfWeek = monthViewSingle.FirstVisibleDay.Date.DayOfWeek

        '	Get the first day of the week
        Dim firstDayInWeek As DateTime = e.Week.FirstDate

        '	Walk either backward or forward to the get the first day
        '	in the same week displayed by the control
        Dim sign As Double = IIf(dayOfWeek > firstDayInWeek.DayOfWeek, 1.0F, -1.0F)

        While (firstDayInWeek.DayOfWeek <> dayOfWeek)

            firstDayInWeek = firstDayInWeek.AddDays(sign)
        End While

        '	Select the week
        monthViewSingle.CalendarInfo.SelectedDateRanges.Clear()
        monthViewSingle.CalendarInfo.SelectedDateRanges.Add(firstDayInWeek, firstDayInWeek.AddDays(6.0F))

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

		private void button1_Click(object sender, System.EventArgs e)
		{
			//	Set the WeekHeaderDisplayStyle property to 'WeekNumber'
			this.ultraMonthViewSingle1.WeekHeaderDisplayStyle = WeekHeaderDisplayStyle.WeekNumber;
		}

		private void ultraMonthViewSingle1_WeekHeaderClicked(object sender, Infragistics.Win.UltraWinSchedule.WeekHeaderClickedEventArgs e)
		{
			UltraMonthViewSingle monthViewSingle = sender as UltraMonthViewSingle;

			//	Set the 'SelectWeek' property of the event arguments to false
			//	so that the default selection does not take place
			e.SelectWeek = false;

			//	Get the first day of the week displayed by the control
			System.DayOfWeek dayOfWeek = monthViewSingle.FirstVisibleDay.Date.DayOfWeek;

			//	Get the first day of the week
			DateTime firstDayInWeek = e.Week.FirstDate;

			//	Walk either backward or forward to the get the first day
			//	in the same week displayed by the control
			double sign = dayOfWeek > firstDayInWeek.DayOfWeek ? 1f : -1f;

			while ( firstDayInWeek.DayOfWeek != dayOfWeek )
			{
				firstDayInWeek = firstDayInWeek.AddDays( sign );
			}

			//	Select the week
			monthViewSingle.CalendarInfo.SelectedDateRanges.Clear();
			monthViewSingle.CalendarInfo.SelectedDateRanges.Add( firstDayInWeek, firstDayInWeek.AddDays(6f) );

		}
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