How to get the tapped week number details in WPF Scheduler (Calendar)
You can get the tapped week number details when tapping the WeekNumber of SfScheduler using the WeekNumberTapped WPF.
XAML
Display the week number of a year in the scheduler month view by setting the ShowWeekNumber property of MonthViewSettings to true. Interaction behavior added to SfScheduler to handle the WeekNumberTapped handler.
<syncfusion:SfScheduler x:Name="Schedule" ViewType="Month" > <syncfusion:SfScheduler.MonthViewSettings> <syncfusion:MonthViewSettings ShowWeekNumber="True"/> </syncfusion:SfScheduler.MonthViewSettings> <interactivity:Interaction.Behaviors> <local:SchedulerBehavior/> </interactivity:Interaction.Behaviors> </syncfusion:SfScheduler>
C#
In WeekNumberTapped, you can get the tapped week number details by using the property of WeekNumber of WeekNumberTappedEventArgs .
public class SchedulerBehavior : Behavior<SfScheduler>
{
SfScheduler scheduler;
protected override void OnAttached()
{
base.OnAttached();
scheduler = this.AssociatedObject;
this.AssociatedObject.WeekNumberTapped += AssociatedObject_WeekNumberTapped;
}
private void AssociatedObject_WeekNumberTapped(object sender, WeekNumberTappedEventArgs e)
{
var no = e.WeekNumber.ToString();
MessageBox.Show("WeekNumber" + " " + no, "WeekNumberTapped", MessageBoxButton.OK);
}
protected override void OnDetaching()
{
base.OnDetaching();
this.AssociatedObject.WeekNumberTapped -= AssociatedObject_WeekNumberTapped;
this.scheduler = null;
}
}
