- Home
- Forum
- Xamarin.Forms
- OnClick
OnClick
Hello,
I have been trying to use SfCalendar, but I am unable to get any response when I click on any dates. I have been trying to follow the documentation, and am confused why the following doesn't work:
C# Code:
public MainPage()
{
InitializeComponent();
SfCalendar calendar = new SfCalendar();
this.Content = calendar;
}
private void Handle_OnCalendarTapped(object sender, Syncfusion.SfCalendar.XForms.CalendarTappedEventArgs args)
{
SfCalendar calendar = args.Calendar;
DateTime date = args.datetime;
System.Diagnostics.Debug.WriteLine("Works");
DisplayAlert("test", "testing", "Yes", "No");
}
Associated 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:local="clr-namespace:App1"
xmlns:calen = "clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms"
x:Class="NAGs.MainPage"
Title = "Calender Control by Synufusion">
<calen:SfCalendar x:Name="Calender"
OnCalendarTapped="Handle_OnCalendarTapped"/>
</ContentPage>
As you can see from the simple code, I just want to have an alert (or debug line) appear when I click on the date so I know it is working. What am I doing wrong?
Thanks,
Dustin
SIGN IN To post a reply.
3 Replies
VA
Vinnalan Aravazhi
Syncfusion Team
May 7, 2018 08:30 AM UTC
Hi Two Chain,
Thanks for contacting Syncfusion support.
We have checked the reported issue "Unable to get any response when I click on any dates in SfCalendar" from our side.
On seeing your code snippet we found that you have defined the Sfcalendar in both Xaml and C# code behind. So it will take the code behind initialization which does not have the event hooked and event is not fired. Now we have modified the sample. Please find the sample from the below link.
Sample: http://www.syncfusion.com/downloads/support/forum/137405/ze/CalendarSample297745128
Thanks for contacting Syncfusion support.
We have checked the reported issue "Unable to get any response when I click on any dates in SfCalendar" from our side.
On seeing your code snippet we found that you have defined the Sfcalendar in both Xaml and C# code behind. So it will take the code behind initialization which does not have the event hooked and event is not fired. Now we have modified the sample. Please find the sample from the below link.
Sample: http://www.syncfusion.com/downloads/support/forum/137405/ze/CalendarSample297745128
Please let us know if you have any other query.
Regards,
Vinnalan K A.
TC
Two Chain
May 7, 2018 08:07 PM UTC
Hi Vinnalan,
Dustin
Thanks for your reply. This seems to be working for me now.
Thanks again!
Dustin
VA
Vinnalan Aravazhi
Syncfusion Team
May 8, 2018 03:55 AM UTC
Hi Two Chain,
Thanks for the update.
We are glad to know that you have achieved your requirement. Please let us know if you have any other queries.
Regards,
Vinnalan K A.
Thanks for the update.
We are glad to know that you have achieved your requirement. Please let us know if you have any other queries.
Regards,
Vinnalan K A.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
TC Two Chain
- May 5, 2018 04:59 AM UTC
- May 8, 2018 03:55 AM UTC