OnAppointmentLoadedEvent not fired in Android month view

Hi

For customizing the appointment style (TextColor, TextSize) I am using the event OnAppointmentLoadedEvent on the month view. The event get fired in XAMARIN.FROMS for UWP but not for Android. I tryed several was to customize the TextColor depndent on different events but could not succeed.  I found several examples of customizing the month cell but not for cutmizing the appointment in the month cell.


Regards,

Bruno


16 Replies 1 reply marked as answer

SS SaiGanesh Sakthivel Syncfusion Team November 19, 2021 03:34 PM UTC

Hi Zimmermann,  
  
Thank you for contacting Syncfusion support.  
  
#Regarding Customize the appointment in the month view.  
We have checked the reported query from our end. Your requirement can be achieved with the help of DataTemplateSelector in SfSchedule. please refer to the following code snippet for your reference.  
 
Code Snippet  
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)  
{  
    var schedule = container as SfSchedule;  
    ViewModel.MonthCellItem = item as MonthCellItem;  
    if (schedule != null)  
    {  
        var appointments = (IList)(item as MonthCellItem).Appointments;  
        //// multiple appointment template  
        if (appointments != null && appointments.Count > 2 )  
            return MonthCellAppointmentTemplate;  
        //// single appointment template   
        else if (appointments != null && appointments.Count == 1)  
            return MonthCellSingleAppointment;  
        //// double appointment template  
        else if (appointments != null && appointments.Count == 2)  
            return MonthCellDoubleAppointment;  
        //// normal template  
        else  
            {  
            return MonthCellTemplate;  
            }        
    }  
    return null;  
}  
  
We have prepared the demo sample as per your requirement. Please refer to the sample in the following locations.  
  
  
Please let us know if you have any concerns.  
  
Regards,
SaiGanesh Sakthivel
 


ZI Zimmermann November 21, 2021 08:18 PM UTC

Hi

Many thanks for the help so far. There are still some points that do not work as expected.

1) The cell content is not drawn as expected as soon as a WidthRequest is use in the schedule control and HorizontalOptions is set to Start for Desktop and Tablet and as Default to Center (default is for Android and iOS). The day number is positioned right and the appointments are not shown -> see attachment

2) When switch on the week numbers the day names are not in line with the grid -> see attachment

3) If I add, delete or update a calendar item in the ObservableCollection attached as source no update is done in the calendar (month view)


I have tested all scenarios on xamarin.forms UWP and Android. On both platform the same wrong behaviour occurs. The wrong behaviours can be reproduced in the example app as well.


Calendar code sample:

                                                  ScheduleView="MonthView"
Margin="10,0,10,0"
WidthRequest="700"
HeightRequest="500"
Locale="{Binding LocaleShort}"
DataSource="{Binding CalendarEvents}"
SelectedDate="{Binding SelectedDate}"
FirstDayOfWeek="{Binding FirstDayOfWeek}"
VerticalOptions="FillAndExpand"
HorizontalOptions="{OnIdiom Desktop=Start, Tablet=Start, Default=Fill}">








SubjectMapping="Subject"
ColorMapping="ColorDisplay"
StartTimeMapping="StartDisplay"
IsAllDayMapping="IsAllDay"
EndTimeMapping="EndDisplay">







MonthCellTemplate="{StaticResource TemplateSelector}"
TodayBackground="Transparent" />




Command="{Binding CellTapped}" />



Regards,

Bruno



Attachment: OnAppointmentLoadedEvent_e30559cb.zip



MS Muniappan Subramanian Syncfusion Team November 22, 2021 10:57 AM UTC

Hi Martin, 
 
Thanks for the update. 
 
Currently, we are analyzing your mentioned issue “Custom month view does not render properly while setting WidthRequest for SfSchedule”. We will validate and update you the further details in two business days (November 24, 2021). We appreciate your patience until then. 
 
Regards, 
Muniappan S. 



SS SaiGanesh Sakthivel Syncfusion Team November 24, 2021 01:39 PM UTC

Hi Zimmermann, 
 
Thank you for the patience. 
 
#Regarding Custom month view does not render properly while setting WidthRequest for SfSchedule and Add and remove the event in the view is not obtained when using the custom month cell 
We have checked the reported query from our end. We have logged the issue report for the same. We will fix the issue and include the issue fix in our Weekly nuget release which is expected to roll out on December 14,2021. We appreciate your patience until then.  
  
You can track the status of this report through the following feedback link,  
  
Note: The provided feedback link is private, you need to login to view this feedback.  
  
Regards,  
SaiGanesh Sakthivel  



SS SaiGanesh Sakthivel Syncfusion Team December 14, 2021 11:35 AM UTC

Hi Zimmermann,  
  
#Regarding Custom month view does not render properly while setting WidthRequest for SfSchedule and Add and remove the event in the view is not obtained when using the custom month cell 
We regret to inform you that due to the complexity in fixing the issue, we could not include the fix in our Weekly nuget release. We will fix the reported issue and include it in our upcoming Weekly nuget release which is planned to roll out on December 21, 2021. We will let you once release rolled out and appreciate your patience until then. 
   
Regards,   
SaiGanesh Sakthivel   



SS SaiGanesh Sakthivel Syncfusion Team December 22, 2021 12:32 PM UTC

Hi Zimmermann, 
 
#Regarding Custom month view does not render properly while setting WidthRequest for SfSchedule and Add and remove the event in the view is not obtained when using the custom month cell  
Due to the Main release, there is no weekly nuget release for this week. We will include the issue fix in our upcoming Weekly nuget release which is expected to roll out on December 28,2021. We appreciate your patience until then.  
  
Regards,     
SaiGanesh Sakthivel  



SS SaiGanesh Sakthivel Syncfusion Team December 28, 2021 02:28 PM UTC

Hi Zimmermann, 
 
We have fixed the issue of ‘Custom month view does not render properly while setting WidthRequest for SfSchedule and Add and remove the event in the view is not obtained when using the custom month cell’ and we have prepared patch including the fix. Before installing the patch, kindly remove bin and obj folders from all the projects of solution and clear NuGet cache. 
 
Please refer our following KB document to clear nuget cache. 
    
 
 
 
Installation Direction:       
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\netstandard\Syncfusion.SfSchedule.XForms.dll             
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\android\Syncfusion. SfSchedule.XForms.Android.dll             
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\ios\Syncfusion. SfSchedule.XForms.iOS.dll             
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\uwp\Syncfusion. SfSchedule.XForms.UWP.dll 
 
Disclaimer:     
Please note that we have created this patch for version 19.4.0.38 specifically to include the issue. 
We will include the issue fix in our upcoming Weekly NuGet release. We appreciate your patience until then. 
 
Regards,    
SaiGanesh Sakthivel 



ZI Zimmermann replied to SaiGanesh Sakthivel December 29, 2021 11:37 AM UTC

Many thanks for the fix

The schedule does now render properly. The add, delete and update of an appointment does not work in the schedule mothly view.


I defined the property CalendarEvents as an observable collection. The collection is retrived from a database (realm) and assigned to the property. In this way the calendar events are not shown until I move to months two times to the left or right and back.


public ObservableCollection CalendarEvents { get; set; }

CalendarEvents = _eventRepo.GetAllCalendarEvents(MyPreferences.CurrentUserCUID);


How can I achive this?


Many Thanks,

Bruno



SS SaiGanesh Sakthivel Syncfusion Team December 30, 2021 05:46 AM UTC

Hi Zimmermann, 
 
We could not replicate the reported scenario in our simple sample from our end. We have prepared the simple sample as per given information and we have checked the sample with x86 processor and Target version 1809(10.0;Build 17763) in UWP platform. Please refer to the tested sample and tested sample video in the following link for your reference. 
 
 
 
Please check the sample and let us know if you still facing the same issue? If not, please modify our sample based on your scenario and revert us back which will be helpful for us to check on it and provide you the solution at the earliest.  
   
Regards,
SaiGanesh Sakthivel 
 



ZI Zimmermann December 31, 2021 10:03 AM UTC

I modified the example to use the realm database and attached it as a Zip. I tried several variants but none of them really worked.

  • Using ObservableCollection

  • Using IQuerable

  • Using IRealmCollection

Following is the explanation from the documentation of realm:

Realm uses standard types to represent groups of objects:

1.    IQueryable<T>, a class representing objects retrieved from queries.

2.    IList<T>, a class representing to-many relationships in models.

At runtime, both conform to the IRealmCollection<T> interface which in turn conforms to IReadOnlyList<T> and INotifyCollectionChanged and supports lazy enumeration - the size of the collection is known but objects are only loaded into memory as you iterate the collection.


Unfortunately, I’m not able to look inside the controls code to find out why it is not working as expected.

Please can you help?


Regards,

Bruno


Attachment: CustomMonth_20211231_cc7c1093.zip


SS SaiGanesh Sakthivel Syncfusion Team January 3, 2022 01:11 PM UTC

Hi Zimmermann, 
 
Thank you for the update. 
 
#Regarding delete and update of an appointment does not work in the schedule mothly view 
Your requirement of ‘delete and update of an appointment’ can be achieved by using ObservableCollection in the SfSchedule. please refer to the following code snippet for your reference. 
 
Viewmodel 
private ObservableCollection<Meeting> scheduleAppointments; 


public
ObservableCollection<Meeting> ScheduleAppointments 
{ 
    get 
    { 
        return scheduleAppointments; 
    } 
    set 
    { 
        scheduleAppointments = value; 
        this.OnPropertyChanged("ScheduleAppointments"); 
    } 
} 
 
ScheduleView.cs 
      viewModel.ScheduleAppointments = new ObservableCollection<Meeting>( _myRealm.All<Meeting>()); 
 
private void Button_Clicked(object sender, EventArgs e) 
{ 
    var button = (sender as Button); 
    var appointments = viewModel.ScheduleAppointments; 
    if (button.Text == "Add") 
    { 
        var meeting = new Meeting(); 
        meeting.Event = "NewAAppointment"; 
        meeting.From = new DateTime(2021, 12, 15, 13, 0, 0); 
        meeting.To = new DateTime(2021, 12, 15, 15, 0, 0); 
        meeting.Color = Color.Orange; 
        meeting.AllDay = false; 
        meeting.BorderColor = (meeting.Color == Color.White) ? Color.Black : Color.White; 
 
        //_myRealm.Write(() => 
        //{ 
        //    _myRealm.Add(meeting); 
        //}); 
        viewModel.ScheduleAppointments.Add(meeting); 
    } 
    else 
    { 
        viewModel.ScheduleAppointments.Remove(appointments.First()); 
        //_myRealm.Write(() => 
        //{ 
        //    _myRealm.Remove(appointments.First()); 
        //}); 
    } 
 
} 
 
private void ButtonUpdate_Clicked ( object sender, EventArgs e ) 
{ 
    var button = (sender as Button); 
    var appointments = viewModel.ScheduleAppointments; 
    Meeting app = new Meeting(); 
    //_myRealm.Write(() => 
    //{ 
    //    app.Event = "Hallo"; 
    //    _myRealm.Add(app, true); 
    //}); 
 
    var firstAppointment = appointments.First(); 
    app.Event = "Hallo"; 
    app.From = firstAppointment.From; 
    app.To = firstAppointment.To; 
    app.Color = Color.LightCoral; 
    app.AllDay = false; 
    app.BorderColor = firstAppointment.BorderColor; 
 
    viewModel.ScheduleAppointments.RemoveAt(0); 
    viewModel.ScheduleAppointments.Insert(0, app); 
} 
 
Please refer to the modified sample in the following locations. 
 
#Regarding Add and remove the event in the view is not obtained when using the custom month cell in Android 
We have fixed the issue of ‘Add and remove the event in the view is not obtained when using the custom month cell’ and we have prepared patch including the fix. Before installing the patch, kindly remove bin and obj folders from all the projects of solution and clear NuGet cache.  
  
Please refer our following KB document to clear nuget cache.  
     
  
  
  
Installation Direction:        
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\libetstandard\Syncfusion.SfSchedule.XForms.dll              
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\android\Syncfusion. SfSchedule.XForms.Android.dll              
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\ios\Syncfusion. SfSchedule.XForms.iOS.dll              
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\uwp\Syncfusion. SfSchedule.XForms.UWP.dll  
  
Disclaimer:      
Please note that we have created this patch for version 19.4.0.38 specifically to include the issue.  
We will include the issue fix in our upcoming Weekly NuGet release. We appreciate your patience until then.  
  
Regards,     
SaiGanesh Sakthivel 


ZI Zimmermann January 3, 2022 08:58 PM UTC

Hi SaiGanesh

Many thanks for the example with using the ObservableCollection. I extended the example in a way that the changes also get written to the database. I did several tests and checked the database. It is working fine for UWP and iOS. Unfortunately, it is not working on Android. No updates are done in the schedule control.

I attached the modified example.

Please can you check why it is not working on Android?

Many Thanks

Bruno


Attachment: CustomMonth_20220103_d6f9e57d.zip


SS SaiGanesh Sakthivel Syncfusion Team January 4, 2022 12:33 PM UTC

Hi Zimmermann, 
 
We have fixed the issue of ‘Add and remove the event in the view is not obtained when using the custom month cell in Android’ and we have prepared patch including the fix. Before installing the patch, kindly remove bin and obj folders from all the projects of solution and clear NuGet cache. 
 
Please refer our following KB document to clear nuget cache. 
    
 
 
 
Installation Direction:       
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\netstandard\Syncfusion.SfSchedule.XForms.dll             
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\android\Syncfusion. SfSchedule.XForms.Android.dll             
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\ios\Syncfusion. SfSchedule.XForms.iOS.dll             
{Syncfusion Installed location}\Essential Studio\19.4.0.38\Xamarin\lib\uwp\Syncfusion. SfSchedule.XForms.UWP.dll 
 
Disclaimer:     
Please note that we have created this patch for version 19.4.0.38 specifically to include the issue. 
We will include the issue fix in our upcoming Weekly NuGet release. We appreciate your patience until then. 
 
Regards,    
SaiGanesh Sakthivel 



ZI Zimmermann replied to SaiGanesh Sakthivel January 7, 2022 10:56 AM UTC

Hi  SaiGanesh

Many thanks for the help. The last version solved the update problem on Android. The schedule in the APP is now working as expected. Unfortunately, I’m not able to check the behaviour with my own app on iOS since I’m still in the process of getting the app ready for iOS. Never less, the behaviour of the test app in iOS was ok.


Kind regards,

Bruno


Marked as answer

SS SaiGanesh Sakthivel Syncfusion Team January 10, 2022 05:12 AM UTC

Hi Zimmermann, 
 
We are glad to know that the given fixed is resolved the issue. Please let us know if you need any further assistance.  
  
Regards,  
SaiGanesh Sakthivel 



SS SaiGanesh Sakthivel Syncfusion Team January 18, 2022 02:00 PM UTC

Hi Zimmermann, 
 
#Regarding Custom month view does not render properly while setting WidthRequest for SfSchedule and Add and remove the event in the view is not obtained when using the custom month cell   
We have fixed the reported issue and included the issue fix in our latest Weekly NuGet release update version 19.4.0.43 onwards which is available for download (nuget.org).   
  
We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.   
   
Regards,   
SaiGanesh Sakthivel   


Loader.
Up arrow icon