/// <summary>
        /// Creates a combo box with data binding.
        /// </summary>
        /// <param name="d">The cell definition.</param>
        /// <returns>
        /// A ComboBox.
        /// </returns>
        protected virtual FrameworkElement CreateComboBox(SelectCellDefinition d)
        {
            var c = new ComboBox
            {
                IsEditable = d.IsEditable,
                Focusable  = false,
                Margin     = new Thickness(1, 1, 0, 0),
                HorizontalContentAlignment = d.HorizontalAlignment,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Padding         = new Thickness(3, 0, 3, 0),
                BorderThickness = new Thickness(0)
            };

            if (d.ItemsSource != null)
            {
                c.ItemsSource = d.ItemsSource;
            }
            else
            {
                if (d.ItemsSourceProperty != null)
                {
                    var itemsSourceBinding = new Binding(d.ItemsSourceProperty);
                    c.SetBinding(ItemsControl.ItemsSourceProperty, itemsSourceBinding);
                }
            }

            c.DropDownClosed += (s, e) => FocusParentDataGrid(c);
            var binding = this.CreateBinding(d);

            binding.NotifyOnSourceUpdated = true;
            c.SetBinding(d.IsEditable ? ComboBox.TextProperty : Selector.SelectedValueProperty, binding);
            c.SelectedValuePath = d.SelectedValuePath;
            this.SetIsEnabledBinding(d, c);
            this.SetBackgroundBinding(d, c);
            return(c);
        }
        /// <summary>
        /// Creates a combo box with data binding.
        /// </summary>
        /// <param name="d">The cell definition.</param>
        /// <returns>
        /// A ComboBox.
        /// </returns>
        protected virtual FrameworkElement CreateComboBox(SelectCellDefinition d)
        {
            var c = new ComboBox
            {
                IsEditable = d.IsEditable,
                Focusable = false,
                Margin = new Thickness(1, 1, 0, 0),
                HorizontalContentAlignment = d.HorizontalAlignment,
                VerticalContentAlignment = VerticalAlignment.Center,
                Padding = new Thickness(3, 0, 3, 0),
                BorderThickness = new Thickness(0)
            };
            if (d.ItemsSource != null)
            {
                c.ItemsSource = d.ItemsSource;
            }
            else
            {
                if (d.ItemsSourceProperty != null)
                {
                    var itemsSourceBinding = new Binding(d.ItemsSourceProperty);
                    c.SetBinding(ItemsControl.ItemsSourceProperty, itemsSourceBinding);
                }
            }

            c.DropDownClosed += (s, e) => FocusParentDataGrid(c);
            var binding = this.CreateBinding(d);
            binding.NotifyOnSourceUpdated = true;
            c.SetBinding(d.IsEditable ? ComboBox.TextProperty : Selector.SelectedValueProperty, binding);
            c.SelectedValuePath = d.SelectedValuePath;
            this.SetIsEnabledBinding(d, c);
            this.SetBackgroundBinding(d, c);
            return c;
        }