How to add Action Buttons in the .NET MAUI Calendar (SfCalendar)?
In this article, we'll demonstrate how to add action buttons to the Syncfusion® .NET MAUI Calendar control by utilizing the ShowActionButtons property of the SfCalendar.
Add the Button control and the SfCalendar control in your layout. Set the ShowActionButtons property of the SfCalendar to True, as shown in the following code sample.
XAML
<Grid RowDefinitions="0.1*, 0.9*"> <Button x:Name="SelectionModeButton" HorizontalOptions="Center" VerticalOptions="Center" Text="Single" Clicked="SelectionModeButton_Clicked"/> <calendar:SfCalendar Grid.Row="1" x:Name="calendar" ShowActionButtons="True" /> </Grid>
In the Button.Clicked event handler, toggle the SelectionMode to Single (or) Range.
C#
private void SelectionModeButton_Clicked(object sender, EventArgs e) { if (this.calendar.SelectionMode == CalendarSelectionMode.Single) { this.calendar.SelectionMode = CalendarSelectionMode.Range; this.SelectionModeButton.Text = "Range"; } else { this.calendar.SelectionMode = CalendarSelectionMode.Single; this.SelectionModeButton.Text = "Single"; } }
By default, the ShowActionButtons property is set to False.
Output:
Conclusion:
I hope you enjoyed learning how to add the action buttons in the .NET MAUI Calendar (SfCalendar).
You can refer to our .NET MAUI Calendar’s feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI Calendar documentation to understand how to present and manipulate data.
For current customers, you can check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our .NET MAUI Calendar and other .NET MAUI components.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!