- Home
- Forum
- Xamarin.Forms
- Text instead of dot indicators for appointments?
Text instead of dot indicators for appointments?
I am creating a calendar that sometimes has a lot of appointments in a single day, and it runs out of space showing the indicator dots. Additionally, showing more than 5 dots is not really useful as more than 5 just sort of blurs together in the human brain. Is it possible to show text instead? E.g. if I have 7 appointments on a given day it would say "7" instead of showing any dots.
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
SS
SaiGanesh Sakthivel
Syncfusion Team
December 18, 2020 11:43 AM UTC
Hi Jonathan,
Thank you for using syncfusion products.
#Regarding Text instead of dot indicators for appointments
We would like to inform you that you can achieved your requirement with help of OnMonthCellLoaded Event. Inside the event, you can custiomize the CellTemplate for each date cell in a view. Please refer to the demo sample in the following link for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/CalendarXamarinCus-1787039453
Please refer to the following code snippet for your reference.
Code Snippet
|
private void Calendar_OnMonthCellLoaded(object sender, Syncfusion.SfCalendar.XForms.MonthCellLoadedEventArgs e)
{
CalendarEventCollection appointmentCollection = viewmodel.CalendarInlineEvents as CalendarEventCollection;
foreach(var appointment in appointmentCollection)
{
if(appointment.StartTime.Date == e.Date)
{
count++;
}
}
if(count != 0)
{
monthViewSettings.CellTemplate = new DataTemplate(() => new NormalCell());
e.CellBindingContext = new DayViewModel(count.ToString(), e.Date.Day.ToString());
count = 0;
}
else
{
monthViewSettings.CellTemplate = new DataTemplate(() => new NormalCell());
e.CellBindingContext = new DayViewModel("", e.Date.Day.ToString());
}
} |
Please refer to the tested output image.
We hope this helps.
Regards,
SaiGanesh Sakthivel
SaiGanesh Sakthivel
Marked as answer
JR
Jonathan Ruland
December 18, 2020 05:36 PM UTC
Thank you very much! I will give this a try.
MS
Muniappan Subramanian
Syncfusion Team
December 21, 2020 04:34 AM UTC
Hi Jonathan Ruland,
Thank you for the update.
We are glad that our solution meets your requirement. Please let us know if you need any further update. As always, we are happy to help you out.
Regards,
Muniappan S.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
- Marked answer
-
JR Jonathan Ruland
- Dec 17, 2020 10:56 PM UTC
- Dec 21, 2020 04:34 AM UTC