# Customizing Day Content

## Content



The [C1 Calendar](/componentone/api/xamarin/online-android/dotnet-api/C1.Android.Calendar/C1.Android.Calendar.C1Calendar.html) control allows users to add custom content to day slot. For this, all you need to do is subscribe to the **DaySlotLoading** event and apply custom content such as images in the background of these slots. This feature allows users to display weather related information on the calendar.

The image below shows a Xamarin Calendar after adding custom content to day slots. The calendar displays weather related information through various icons.

![](https://cdn.mescius.io/document-site-files/images/b011ec9b-8b9c-49b7-96b6-ebd2d5673a5e/images/calendar_customdaycontent.png)

The following code example demonstrates how to add custom content to day slots on the calendar using C#. This example uses the sample created in [Quick Start](/componentone/docs/xamarin/online-android/controls/CalendarOverview/CalendarQuickStart) section.


> type=note
> Add the image icons as resource files at **YourProject\\Resources\\drawable** location in your VisualStudio project. By default, you can find these images at _C:\\\<User>\\Documents\\ComponentOne Samples\\Xamarin\\Android\\C1Calendar101\\Resources\\drawable_

### In Code

Complete the following steps to add custom content to day slots.

```csharp
public class MainActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            SetContentView(Resource.Layout.CustomDayContent);
            var calendar = FindViewById<C1Calendar>(Resource.Id.Calendar);
            calendar.DaySlotLoading += OnDaySlotLoading;
        }
        private void OnDaySlotLoading(object sender, CalendarDaySlotLoadingEventArgs e)
        {
            // add weather image for certain days in the current month
            if (e.Date.Year == DateTime.Today.Year &&
                e.Date.Month == DateTime.Today.Month &&
                e.Date.Day >= 14 && e.Date.Day <= 23)
            {
                var slot = LayoutInflater.Inflate(Resource.Layout.DaySlot, null);
                var iv = slot.FindViewById<ImageView>(Resource.Id.Image);
                var tv = slot.FindViewById<TextView>(Resource.Id.Day);
                tv.Text = e.Date.Day.ToString();
                switch (e.Date.Day % 5)
                {
                    case 0:
                        iv.SetImageResource(Resource.Drawable.Cloudy);
                        break;
                    case 1:
                        iv.SetImageResource(Resource.Drawable.PartlyCloudy);
                        break;
                    case 2:
                        iv.SetImageResource(Resource.Drawable.Rain);
                        break;
                    case 3:
                        iv.SetImageResource(Resource.Drawable.Storm);
                        break;
                    case 4:
                        iv.SetImageResource(Resource.Drawable.Sun);
                        break;
                }
                e.DaySlot = slot;
            }
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId == global::Android.Resource.Id.Home)
            {
                Finish();
                return true;
            }
            else
            {
                return base.OnOptionsItemSelected(item);
            }
        }
    }
```