Version

TimeRangeAppearances Property

Returns a collection of TimeRangeAppearance objects, which makes it possible to associate an Appearance object with one or more TimeSlots.
Syntax
'Declaration
 
Public ReadOnly Property TimeRangeAppearances As TimeRangeAppearancesCollection
public TimeRangeAppearancesCollection TimeRangeAppearances {get;}
Remarks

Appearance properties are exposed by the UltraDayView control and the Owner class which allow customization of the visual attributes of TimeSlots displayed for working and non-working hours. These appearances, however, apply to all days; the TimeRangeAppearances property provides a mechanism through which these visual attributes can be customized for any arbitrarily selected date and range of time.

A TimeRangeAppearance object overrides all working-hour criteria when a TimeSlot's appearance is resolved.

Since the TimeRangeAppearances collection is exposed by several different classes, it is possible to define appearances at various different levels, i.e., for a specific date, a day of the week, or based on a recurring date pattern. The following table details order of precedence in the property resolution process for the TimeRangeAppearances collection:

Order of precedence Resolved value
1) OwnerDateSettings If the Owner's DateSettings collection contains an entry for the date to be resolved, that entry is evaluated. If it does not, the resolution process proceeds to the next level. If the TimeRangeAppearances collection is non-empty, and a member exists whose time range intersects with that of the TimeSlot whose appearance is to be resolved, the TimeSlot resolves its appearance through that member. Note that any properties that are not explicitly set on its appearance are left available to be resolved by the next player in the resolution chain.
2) OwnerRecurringDateSettings If the Owner's RecurringDateSettings collection contains one or more members, each is examined to determine whether the date to be resolved coincides with the recurrence pattern defined by the Recurrence property. If it does not, the resolution process proceeds to the next level. If the TimeRangeAppearances collection is non-empty, and a member exists whose time range intersects with that of the TimeSlot whose appearance is to be resolved, the TimeSlot resolves its appearance through that member. Note that any properties that are not explicitly set on its appearance are left available to be resolved by the next player in the resolution chain.

Note that in the case where more than one recurrence generates an occurrence for the same date, precedence for that date is given to the instance closest to the beginning of the collection. For this reason it is recommended that when using multiple recurrences to define working hours, the recurrence that generates occurrences at the lowest frequency should be positioned closest to the beginning of the collection.

3) DayOfWeekSettings This is the final level of the property resolution hierarchy. The member of the DayOfWeekSettings collection which corresponds to the date to be resolved is referenced; if the TimeRangeAppearances collection is non-empty, and a member exists whose time range intersects with that of the TimeSlot whose appearance is to be resolved, the TimeSlot resolves its appearance through that member. Note that any properties that are not explicitly set on its appearance are left available to be resolved by the next player in the resolution chain.

Example
The following code sample demonstrates how to use the Owner's DateSettings collection to specify working hours and a custom time range appearance for a particular date:

Imports System.Collections.Generic
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics

        '  Add a new Owner to the Owners collection
        Dim myOwner As Owner = Me.calendarInfo.Owners.Add("myCalendar")

        '  Create an OwnerDateSettings object for the first day of the current month
        Dim dateSettings As OwnerDateSettings = New OwnerDateSettings(New DateTime(DateTime.Today.Year, DateTime.Today.Month, 1))

        '  Designate the day as a workday
        dateSettings.IsWorkDay = DefaultableBoolean.True

        '  Add two sets of working hours, one for 9AM to 12PM,
        '  and another for 1PM to 5PM
        dateSettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(9), TimeSpan.FromHours(12)))
        dateSettings.WorkingHours.Add(New TimeRange(TimeSpan.FromHours(13), TimeSpan.FromHours(17)))

        '  Create an appearance to indicate that the office is closed
        Dim officeClosedAppearance As Appearance = New Appearance()
        officeClosedAppearance.BackColor = Color.White
        officeClosedAppearance.BackColor2 = Color.LightGray
        officeClosedAppearance.BackGradientStyle = GradientStyle.Horizontal
        officeClosedAppearance.BorderColor = Color.Transparent

        '  Create TimeRanges for the hours during which the office is closed,
        '  which is 12AM to 6AM, and 8PM to 12AM
        Dim closed1 As TimeRange = New TimeRange(TimeSpan.FromHours(0), TimeSpan.FromHours(6))
        Dim closed2 As TimeRange = New TimeRange(TimeSpan.FromHours(20), TimeSpan.FromHours(24))

        '  Add two TimeRangeAppearance objects, one for each range during which
        '  the office is closed
        dateSettings.TimeRangeAppearances.Add(closed1, officeClosedAppearance)
        dateSettings.TimeRangeAppearances.Add(closed2, officeClosedAppearance)

        '  Add the OwnerDateSettings object to the Owner's DateSettings collection
        myOwner.DateSettings.Add(dateSettings)
using System.Collections.Generic;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;

    //  Add a new Owner to the Owners collection
    Owner myOwner = this.calendarInfo.Owners.Add( "myCalendar" );

    //  Create an OwnerDateSettings object for the first day of the current month
    OwnerDateSettings dateSettings = new OwnerDateSettings( new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1) );

    //  Designate the day as a workday
    dateSettings.IsWorkDay = DefaultableBoolean.True;

    //  Add two sets of working hours, one for 9AM to 12PM,
    //  and another for 1PM to 5PM
    dateSettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(9), TimeSpan.FromHours(12) ) );
    dateSettings.WorkingHours.Add( new TimeRange( TimeSpan.FromHours(13), TimeSpan.FromHours(17) ) );

    //  Create an appearance to indicate that the office is closed
    Appearance officeClosedAppearance = new Appearance();
    officeClosedAppearance.BackColor = Color.White;
    officeClosedAppearance.BackColor2 = Color.LightGray;
    officeClosedAppearance.BackGradientStyle = GradientStyle.Horizontal;
    officeClosedAppearance.BorderColor = Color.Transparent;

    //  Create TimeRanges for the hours during which the office is closed,
    //  which is 12AM to 6AM, and 8PM to 12AM
    TimeRange closed1 = new TimeRange( TimeSpan.FromHours(0), TimeSpan.FromHours(6) );
    TimeRange closed2 = new TimeRange( TimeSpan.FromHours(20), TimeSpan.FromHours(24) );

    //  Add two TimeRangeAppearance objects, one for each range during which
    //  the office is closed
    dateSettings.TimeRangeAppearances.Add( closed1, officeClosedAppearance );
    dateSettings.TimeRangeAppearances.Add( closed2, officeClosedAppearance );

    //  Add the OwnerDateSettings object to the Owner's DateSettings collection
    myOwner.DateSettings.Add( dateSettings );
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