Open topic with navigation

SetDate Method (ICalendar)
Sets the date of a WPF calendar or of a date picker.

C# Syntax

    void SetDate(
       DateTime date
    )

Parameters

date
  The date to set.

Example

    // This example locates and sets the date of the date picker control.
    private void ChooseFlightDate()
    {
        // Identify the date picker control. The date picker is identified through the main window and not directly from the Flight GUI applications.
        var flightDatePicker = Desktop.Describe<IWindow>(new WindowDescription
        {
            ObjectName = @"Micro Focus MyFlight Sample",
            FullType = @"window",
            WindowTitleRegExp = @"Micro Focus MyFlight Sample"
        }).Describe<ICalendar>(new CalendarDescription
        {
            ObjectName = @"datePicker"
        });
        // Select the flight date.
        flightDatePicker.SetDate(new DateTime(year:2025, month:8, day:1));
    }