Version

Text Property (VisibleDay)

Gets/sets the text that is displayed by the header that represents this VisibleDay in the user interface.
Syntax
'Declaration
 
Public Property Text As String
public string Text {get; set;}
Remarks

The Text property for the VisibleDay takes precedence over the formatted date that would otherwise be displayed in the header.

Note: Because VisibleDay objects are removed from the UltraDayView control's VisibleDays collection (and thus destroyed) when the corresponding date is removed from the SelectedDateRanges collection, property settings of the VisibleDay object are not persisted.

The UltraDayView control's UltraDayView.InitializeVisibleDay event can be handled and used to set the Text property of the VisibleDay object.

Example
This code sample demonstrates how to use the UltraDayView control's DayTextFormat and the VisibleDay object's Text property, in conjunction with the InitializeVisibleDay event, to customize the text that is displayed by the DayHeaderUIElement.

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_InitializeVisibleDay(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.VisibleDayEventArgs) Handles ultraDayView1.InitializeVisibleDay

        '	Set the DayTextFormat property, which will apply
        '	to VisibleDays whose Text property is not explicitly set.
        If Me.ultraDayView1.DayTextFormat.Length = 0 Then
            Me.ultraDayView1.DayTextFormat = "dd-MMM-yy"
        End If

        '	Explicitly set the VisibleDay's Text property for
        '	yesterday, today, and tommorow.
        If (e.VisibleDay.Date.Date.Equals(DateTime.Today)) Then
            e.VisibleDay.Text = "Today"
        ElseIf (e.VisibleDay.Date.Date.Equals(DateTime.Today.AddDays(-1.0F))) Then
            e.VisibleDay.Text = "Yesterday"
        ElseIf (e.VisibleDay.Date.Date.Equals(DateTime.Today.AddDays(1.0F))) Then
            e.VisibleDay.Text = "Tommorow"
        End If

    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;

		private void ultraDayView1_InitializeVisibleDay(object sender, Infragistics.Win.UltraWinSchedule.VisibleDayEventArgs e)
		{
			//	Set the DayTextFormat property, which will apply
			//	to VisibleDays whose Text property is not explicitly set.
			if ( this.ultraDayView1.DayTextFormat.Length == 0 )
				this.ultraDayView1.DayTextFormat = "dd-MMM-yy";

			//	Explicitly set the VisibleDay's Text property for
			//	yesterday, today, and tommorow.
			if ( e.VisibleDay.Date.Date.Equals( DateTime.Today ) )
				e.VisibleDay.Text = "Today";
			else
			if ( e.VisibleDay.Date.Date.Equals( DateTime.Today.AddDays(-1f) ) )
				e.VisibleDay.Text = "Yesterday";
			else
			if ( e.VisibleDay.Date.Date.Equals( DateTime.Today.AddDays(1f) ) )
				e.VisibleDay.Text = "Tommorow";
		}
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