We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

dynamic data for sfCalendar

Thread ID:

Created:

Updated:

Platform:

Replies:

125283 Aug 5,2016 02:43 AM UTC Aug 8,2016 06:10 PM UTC Windows Phone 3
loading
Tags: SfCalendar
Rod Barrand
Asked On August 5, 2016 02:43 AM UTC

Hi, I'm working off the sample AppointmentsDemo and trying to populate AppointmentSource from data in sqlite. I pass in month, year and a class object and i get the data ok and see it is added to appointment class, however the converter doesn't pick it up, the parameter count is always 0, method is below, any help appreciated.

public List<Post> GetAccountCalendarData(int month, int year, Account myObject)
        {
            string firstDay = GetFirstDayOfMonth(month).ToString();
            string lasttDay = GetLastDayOfMonth(month).ToString();
            DateTime fDay = Convert.ToDateTime(firstDay);
            DateTime lDay = Convert.ToDateTime(lasttDay);
            int m = month;
            int y = year;
         
            var items = (from s in Table<Post>()
                         where s.PostType.Equals("calendar")
                         && s.StartDate >= fDay && s.StartDate <= lDay
                           && s.AccountId == myObject.Id
                         select s).OrderBy(s => s.Id).ToList();
           
            AppointmentSource appointment = new AppointmentSource();
            
            foreach (var data in items)
            {
                // this is where i add it to dictionary in AppointmentSource
                appointment.Add(Convert.ToDateTime(data.StartDate), new Appointment(data.Title.ToString(), data.BodyHtml.ToString()));
            }
            return items;
        }

Vijayalakshmi Roopkumar [Syncfusion]
Replied On August 5, 2016 03:07 PM UTC

Hi Rod, 
Thank you for contacting Syncfusion Support. 
We have prepared a sample base on your update. In this sample we have used converter to get the appointment and bound that converter into the CellTemplate. 
Please download the sample form the below link
Sample:CalAppoimentSample 
Could you please let us know whether this is the requirement you are stating in your update? If not, can you please modify our sample into issue reproducing or brief about your requirement clearly. So that it would be helpful for us to proceed further on this. 
Regards,
Vijayalakshmi.V.R  


Rod Barrand
Replied On August 5, 2016 08:48 PM UTC

Thank you, this seems like it will work for me, the only issue i have now is my collection also contains a specific time, like 03/08/2016 2:15:00 AM
I need to keep the time in order to display it
When i run through the converter the appointments.ContainsKey is never true unless its 12:00:00
I'll try and workout how i can just compare the date part and should be good to go

Thanks again
Rod


Venkateshwaran Ramdoss [Syncfusion]
Replied On August 8, 2016 06:10 PM UTC

Hi Rod, 

Thank you for your update. 

We have sort the appointments using the Dictionary key. We have prepared a sample using the same and it can be downloaded from the below link. 


Code snippet: 
if (appointments != null) 
            { 
                var appoinments = appointments.Keys.Where(datatime => datatime.Date == date).ToList(); 
                if(appoinments.Count > 0) 
                { 
                    appoinments.Sort(); 
                    ObservableCollection<string> AppoinmentInfo = new ObservableCollection<string>(); 
                    foreach (var datetime in appoinments) 
                    { 
 
                       foreach(var details in appointments[datetime].Descriptionlist) 
                        { 
                            AppoinmentInfo.Add(details); 
                        } 
                        AppoinmentInfo.Add("Time:" + datetime.Hour+":"+ datetime.Minute+":"+ datetime.Second); 
                    } 
                    return AppoinmentInfo; 
                } 
            } 


Regards, 
Venkateshwaran V.R. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;