Articles in this section

How to get the tapped week number details in WinUI Scheduler (Calendar)

Get the tapped week number details by tapping the WeekNumber of the WinUI Scheduler using the WeekNumberTapped event.

XAML

Display the week number of a year in the scheduler month view by setting the ShowWeekNumber property of MonthViewSettings to true. Handler for WeekNumberTapped is defined with the Scheduler.

<Grid>
    <scheduler:SfScheduler 
    x:Name="Schedule" 
    ViewType="Month"
    WeekNumberTapped="OnWeekNumberTapped">
        <scheduler:SfScheduler.MonthViewSettings>
            <scheduler:MonthViewSettings ShowWeekNumber="True"/>
        </scheduler:SfScheduler.MonthViewSettings>
    </scheduler:SfScheduler>
</Grid>

C#

In the WeekNumberTapped, get the tapped week number details by using the property of the WeekNumber of WeekNumberTappedEventArgs.

//Event customization
private async void OnWeekNumberTapped(object sender, WeekNumberTappedEventArgs e)
{
    var number = e.WeekNumber.ToString();
    ContentDialog contentDialog = new ContentDialog()
    {
        Title = "WeekNumberTapped",
        Content = "WeekNumber" + " " + number,
        CloseButtonText = "Ok"
    };
    //Set XamlRoot for WinUI desktop applications
    contentDialog.XamlRoot = this.Schedule.XamlRoot;
    await contentDialog.ShowAsync();
}

A picture containing calendar

Description automatically generated

Take a moment to pursue the documentation. You can also find the options to show the week view number.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied