Version

DateSettings Property (Owner)

Returns a collection of OwnerDateSettings objects which expose TimeSlot-related properties that apply to a specific date.
Syntax
'Declaration
 
Public ReadOnly Property DateSettings As OwnerDateSettingsCollection
public OwnerDateSettingsCollection DateSettings {get;}
Remarks

The UltraCalendarInfo's DaysOfWeek collection exposes objects, each of which apply to a specific day of the week, that allow one working hour range to be defined for that day of the week. This is accomplished by setting the WorkDayStartTime and WorkDayEndTime properties. Any day of the week can also be designated as a non-work day by setting the IsWorkDay property.

With the addition of multiple calendar support via the Owner object, the owner's DayOfWeekSettings collection provided a way to customize the working hour range (as well as whether it is a workday) for a given day of the week for that particular owner (independent of other members of the same Owners collection).

The DateSettings collection provides a repository for a new class, OwnerDateSettings, which extends the existing metaphor to provide a way to specify multiple working hour ranges for a specific date.

Note: For a detailed explanation of the order of precedence used when resolving working hours and time slot appearances, refer to the IsWorkDay, WorkingHours, and TimeRangeAppearances properties of the OwnerTimeSlotSettings class.

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