Adding icons to appointments

How would I go about adding icons to the appointments in day/(work) week view? I know I could pass in a custom view in AppointmentLoaded, but how would I know the size of the appointment, etc.?

3 Replies

SG Swathi Gopal Syncfusion Team November 8, 2017 11:42 AM UTC

Hi Olaf, 
  
Thank you for contacting Syncfusion Support. 
  
Based on your requirement, we have created a simple sample with adding icons through custom view for appointments in AppointmentLoaded event in Schedule Xamarin.Android. Appointment rendering size can be known from the “Bounds” property in the corresponding event. 
  
 
Code snippet: 
  
void Schedule_AppointmentLoaded(object sender, AppointmentLoadedEventArgs e)
        {
            //UI Bounds of an appointment.
            var appointmentBounds = e.Bounds;

            FrameLayout frameLayout = new FrameLayout(this);
            frameLayout.SetBackgroundColor(Color.Red);
            TextView monthCellText = new TextView(this);
            monthCellText.SetBackgroundColor(Color.Red);

            monthCellText.Text = e.Appointment.Subject;
            monthCellText.SetTextColor(Color.White);
            monthCellText.TextSize = (14);
            monthCellText.SetPadding(86000);

            ImageView imageView = new ImageView(this);
            imageView.SetPadding(8000);
            frameLayout.AddView(monthCellText);

            if (monthCellText.Text == "B'Day Party")
            {
                imageView.SetImageResource(Resource.Drawable.BirthDate);
            }
            else if(monthCellText.Text == "Health Checkup")
            {
                imageView.SetImageResource(Resource.Drawable.hospital);
            }

            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(4660);
            imageView.LayoutParameters = (layoutParams);
            frameLayout.AddView(imageView);
            e.View = frameLayout;    
        } 
  
  
You can also refer our online user guide documentation regarding customizing appointments through event from the below link, 
  
  
Please let us know if you have any concerns. 
  
Regards,
Swathi G 



OB Olaf Bartelt November 8, 2017 01:26 PM UTC

Hi Swathi,

thanks, it's working like a charm! One thing I've noticed though is that the event handler doesn't seem to be called for all-day appointments. Is there any way to style those, too?

Olaf



SG Swathi Gopal Syncfusion Team November 9, 2017 06:27 PM UTC

Hi Olaf,

Currently we don’t have support to customize all-day appointments in Schedule Xamarin.Android. We have and logged a feature request for the same in our database. We will provide support in any of our upcoming release. We will let you know once we have provided the support.

Please let us know if you have any query.

Regards,
Swathi G

Loader.
Up arrow icon