private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ComboItemComboBox control = (ComboItemComboBox)d;

            if (e.NewValue != null)
            {
                d.CoerceValue(SelectedItemProperty);
            }
        }
        private static object OnCoerceSelectedItem(DependencyObject d, object baseValue)
        {
            ComboItemComboBox control = (ComboItemComboBox)d;
            ComboItem         item    = (ComboItem)baseValue;

            if (item == null)
            {
                if (control.ItemsSource == null)
                {
                    return(null);
                }
                else
                {
                    return(((IEnumerable <ComboItem>)control.ItemsSource).FirstOrDefault());
                }
            }
            else
            {
                return(baseValue);
            }
        }