How to clear picker if It is selected in xamarin forms?
<p>I have two picker. second picker is dependent on first picker. Both pickers are bind from Service. I am using dictionary object to bind data to picker. <strong>I am not using MVVM pattern.</strong></p>

<ol>
<li>First service call where dictionary object for first picker is bind.</li>
<li>then fill first picker from that dictionary object. At that time Second picker is empty.</li>
<li>On selectedIndexChange event of first picker call service to bind dictionary object of second picker. </li>
<li>Now Fill values to second picker from dictionary object. (If already picker has data then put <strong>Picker.Items.clear()</strong>)</li>
<li>Now If I select some value from second picker and change value of first picker then It gives me error at <strong>Picker.Items.clear()</strong></li>
</ol>

<blockquote>
  <p>System.ArgumentOutOfRangeException: Index was out of range. Must be
  non-negative and less than the size of the collection.</p>
  
  <p>Parameter name: index</p>
</blockquote>

<p><strong>Global Declaration :</strong></p>

<pre><code>Dictionary&lt;string, string&gt; DicObjActivityType;

Dictionary&lt;string, string&gt; DicObjSelfActivity;
</code></pre>

<p><strong>First Picker selectedIndexChange event</strong></p>

<pre><code>private async void PckrActivityType_SelectedIndexChanged(object sender, EventArgs e)
{
    if (sender as Picker == null)
        return;
    else
    {
        var objActivityType = sender as Picker;
        var Key = DicObjActivityType.FirstOrDefault(x =&gt; x.Value == objActivityType.Items[objActivityType.SelectedIndex]).Key;
        PickedActivityType = Key;
        if (Key != "0")
        {
            PckrSelfActivity.IsEnabled = true;
            await CallGetWebService_SelfActivity(Key);
            if (PckrSelfActivity.IsEnabled == true)
            {
                PckrSelfActivity.Items.Clear();
                foreach (string items in DicObjSelfActivity.Values)
                {
                    PckrSelfActivity.Items.Add(items);
                }
            }
        }
        else
        {
            PckrSelfActivity.IsEnabled = false;
        }
    }
}
</code></pre>

<p><strong>Call Service of second picker</strong></p>

<pre><code>private async Task CallGetWebService_SelfActivity(string strkey)
{
    try
    {
        var response = await GetResponseFromWebService.GetResponse&lt;ServiceClasses.RootObject_LstListComboData&gt;(ServiceURL.GetSelfActivity + "ActivityTypeCd=" + strkey);

        if (response.Flag == true)
        {
            DicObjSelfActivity = new Dictionary&lt;string, string&gt;();
            DicObjSelfActivity.Add("0", "--Select--");
            if (response.lstListComboData != null)
            {
                foreach (ServiceClasses.LstListComboData Items in response.lstListComboData)
                {
                    DicObjSelfActivity.Add(Items.Value, Items.Text);
                }
            }
        }
        else
        {
            PckrSelfActivity.IsEnabled = false;
        }
    }
    catch (Exception e)
    {
        await DisplayAlert(AppResources.LError, AppResources.LConnectionError, "OK");
    }
}
</code></pre>

<p>I refer following link to solve this issue</p>

<p><a href="https://forums.xamarin.com/discussion/55922/picker-clear-system-argumentoutofrangeexception" rel="nofollow noreferrer">https://forums.xamarin.com/discussion/55922/picker-clear-system-argumentoutofrangeexception</a></p>

<p>but didn't find solution.</p>

<p><strong>We can't clear picker if any of the value is selected?</strong></p>

<p><strong>I don't want to use BindablePicker cutom control.</strong></p>