Category / Section
How to handle the long press action on date selection in SfCalendar?
1 min read
You can able to handle the long press action on date selection in calendar using OnDateCellHolding event.
MainPage.Xaml
<?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:LocalNamespace="clr-namespace:GettingStartedKBSyncfusion" xmlns:Syncfusion ="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms" x:Class="GettingStartedKBSyncfusion.MainPage"> <ContentPage.Content> <Syncfusion:SfCalendar x:Name="calendar"/> </ContentPage.Content> </ContentPage>
MainPage.CS
namespace GettingStartedKBSyncfusion { public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); calendar.OnDateCellHolding+=(object sender, DayCellHoldingEventArgs args) => { DisplayAlert("DateCellHold Response","DateCell"+args.Date.Day+"has been long pressed","Ok"); }; } } }
Please download the sample from the following link
Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DateCellHolding-854177228
Screenshot: