# Custom Selection

## Content



You can customize the default behavior of the [C1Calendar](/componentone/api/xamarin/online-ios/dotnet-api/C1.iOS.Calendar/C1.iOS.Calendar.C1Calendar.html) control to select specific dates. For instance, consider a scenario where you wish to select only the weekdays on tapping two dates in different workweeks. For this, you simply need to subscribe the [SelectionChanging](/componentone/api/xamarin/online-ios/dotnet-api/C1.iOS.Calendar/C1.iOS.Calendar.C1Calendar.SelectionChanging.html) event and apply selection condition in the handler.

The following image shows a C1Calendar that only selects weekdays and deselect weekends on tapping two different dates in different workweeks.

![](https://cdn.mescius.io/document-site-files/images/1398d806-ac3c-4763-a9b3-2c7a2f5b49fb/images/calendarios_customselection.png)

The following code example shows how to customize selection in C1Calendar control in C#. The example uses the sample created in the [Quick Start](/componentone/docs/xamarin/online-ios/controls/calendarOverview/QuickStart).

1.  Replace the content of the ViewController.cs file with the code given below.
    
    ```csharp
    using C1.iOS.Calendar;
    using System;
    using UIKit;
    namespace CalendariOS
    {
        public partial class ViewController : UIViewController
        {
            public ViewController(IntPtr handle) : base(handle)
            {
            }
            public override void ViewDidLoad()
            {
                base.ViewDidLoad();
                Calendar.SelectionChanging += OnSelectionChanging;
            }
            public override void ViewDidUnload()
            {
                base.ViewDidUnload();
                Calendar.SelectionChanging -= OnSelectionChanging;
            }
            private void OnSelectionChanging(object sender, CalendarSelectionChangingEventArgs e)
            {
                foreach (var date in e.SelectedDates.ToArray())
                {
                    if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday)
                        e.SelectedDates.Remove(date);
                }
            }
        }
    }
    ```