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.
Unfortunately, activation email could not send to your email. Please try again.

SfSchedule: Display appointment data in monthview - appointment has no data in MonthCellLoaded event

Thread ID:

Created:

Updated:

Platform:

Replies:

131986 Aug 7,2017 07:26 AM Aug 17,2017 10:02 AM Xamarin.Forms 7
loading
Tags: SfSchedule
bkind
Asked On August 7, 2017 07:26 AM

Hi,

For some time I wondered if I could show appointment data in the SfSchedule MonthView cells. Then I found "how to display subject in monthview?" and tried the ScheduleMonthView_CustomCell_Sample. The good news is that I can change the cell view using the MonthCellLoaded event, eg insert a Label. But when I try to set the Label text to the appointment subject then the text remains empty because the appointment subject is empty, at least inside the event handler. When I open the appointment's inline view then the subject has the expected value. However, the appointment must/could have the begin date set inside the event handler - otherwise it would not have been assigned to the appropriate cell.

My questions are:
  1. Will the appointment subject (begin, end, color etc.) be assigned to the appointment before or after the MonthCellLoaded event?
  2. Does it matter if the appointments get the data from a observable list via ScheduleAppointmentMapping (it does in my case)?
  3. If the appointment won't have it's data assigned before MonthCellLoaded event: is there any other way to show the subject inside a MonthView cell?

Kind regards

(using release 15.2.0.46)


bkind
Replied On August 8, 2017 06:45 AM

Hi again,

Yesterday I tested the mentioned sample again. The sample works and shows the labels in the MonthViewCells as long as one does not set eg. the label text to eg. the appointment subject. So, in Schedule_MOnthCell_SamplePage.Schedule_InMonthCellLoadedEvent, if you replace

label.Text = "2";

with

label.Text = appointments[0].Subject;

then neither of both labels will be shown. The event handler will be executed, but it's result will be ignored and the default Cell content will be shown.

Since appointments[0] is not null and appointments[0].Subject is the empty string I would at least expect that both labels would appear, the first one with empty text.

I think this might be a bug.

Kind regards


Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 8, 2017 10:16 AM

Hi B Kind, 
 
Thank you for contacting Syncfusion support. 
 
Currently we are analyzing your requirement of customizing the Month cell with Appointment details in Xamarin Forms from our side to achieve the same in sample level. We will check and update you the details at the earliest. We appreciate your patience until then. 
 
Regards.
Subburaj Pandian V 


Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 10, 2017 10:33 AM

Hi B Kind,  
 
Thank you for your patience. 
 
We have fixed the mentioned issue with MonthCellLoaded event appointment argument in Xamarin Forms Android and included the issue fix in our latest our Essential Studio Volume 3, 2017 (Version 15.3.0.26) release and is available for download under the following link. 
  
                                              
Note: If DataSource is a ScheduleAppointmentCollection you can condition for appointment below, 
 
[c#] 
var appointments = e.appointments as ObservableCollection<object>; 
 
foreach (var item in appointments)
                {
                    button.Text = (item 
as ScheduleAppointment).Subject;
                }
 
 
 
Could you please check with this latest update and let us know if you have any query. 
 
Regards.
Subburaj Pandian V  
 


bkind
Replied On August 11, 2017 05:40 PM

Hi,

Thank you for your answer. It'll take two or three weeks before I can download and check the 15.3 release.

I'll write as soon as I've checked.

Kind regards


Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 14, 2017 08:51 AM

Hi B Kind,   
  
Thank you for the update, we will wait to hear from you.  
 
Regards,  
Subburaj Pandian V. 


bkind
Replied On August 16, 2017 05:40 PM

Hi again,

I managed to download the 15.3 release and made some tests.

Good news: appointments[0] does contain the appointment data now, although appointments is not of type ScheduleAppointmentCpllection anymore but ObservableCollection<object>.

Bad news however, after assigning a View (StackLayout in this case) to args.View the App crashes as soon as the method returns, no matter if I assign data from the appointment or not.

Am I missing something or is this another bug?

Kind regards

Debug Output:

UNHANDLED EXCEPTION:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at (wrapper managed-to-native) Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_void_method_a (intptr,intptr&,intptr,intptr,intptr,Java.Interop.JniArgumentValue*)
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00073] in <bd30a18775d94dc8b6263aecd1ca9077>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001f] in <bd30a18775d94dc8b6263aecd1ca9077>:0
at Android.Views.ViewGroup.Layout (System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00062] in <d855bac285f44dda8a0d8510b679b1e2>:0
at Xamarin.Forms.Platform.Android.ViewRenderer`2[TView,TNativeView].OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00059] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\ViewRenderer.cs:137
at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean p0, System.Int32 p1, System.Int32 p2, System.Int32 p3, System.Int32 p4) [0x00008] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android.FormsViewGroup\obj\Release\generated\src\Xamarin.Forms.Platform.Android.FormsViewGroup.cs:240
at (wrapper dynamic-method) System.Object:fb76c2f6-e03b-4b81-a9c0-e343eba7a21b (intptr,intptr,bool,int,int,int,int)


Subburaj Pandian Veluchamy [Syncfusion]
Replied On August 17, 2017 10:02 AM

Hi B Kind,    
   
We have created a support incident under your account to track the status of this issue. Please log on to our support website to check for further updates. 
 
 
Please let us know, if you have any query.

Regards, 
Subburaj Pandian V.

 


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.

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.

;