Category / Section
How to programmatically select the date in .NET MAUI Scheduler (SfScheduler)?
3 mins read
MAUI Scheduler allows you to select the DateTime of timeslot or month cell on interaction. You can also set the same programmatically by using the SelectedDate property of the Scheduler.
XAML
<Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="50"/> </Grid.RowDefinitions> <scheduler:SfScheduler x:Name="Scheduler" View="Month"/> <Button x:Name="button" Text="Change Selected date" Clicked="button_Clicked" Grid.Row="1" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" /> </Grid>
CS
By using the button clicked event, you can change the selected date.
public MainPage() { InitializeComponent(); } private void button_Clicked(object sender, EventArgs e) { this.Scheduler.SelectedDate = DateTime.Today.AddDays(9); }