/// <summary>
        /// Creates a text box with data binding.
        /// </summary>
        /// <param name="d">The cell definition.</param>
        /// <returns>
        /// A TextBox.
        /// </returns>
        protected virtual FrameworkElement CreateTextBox(TextCellDefinition d)
        {
            var c = new TextBox
            {
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = d.HorizontalAlignment,
                MaxLength       = d.MaxLength,
                BorderThickness = new Thickness(0),
                Margin          = new Thickness(1, 1, 0, 0)
            };

            c.Loaded += (sender, args) =>
            {
                var tb = (TextBox)sender;
                tb.CaretIndex = tb.Text.Length;
                tb.SelectAll();
            };

            var binding = this.CreateBinding(d);

            c.SetBinding(TextBox.TextProperty, binding);
            this.SetIsEnabledBinding(d, c);
            this.SetBackgroundBinding(d, c);

#if DATAGRID_DEBUG_INFO
            c.ToolTip = $"Binding: {binding.Path.Path} {binding.Mode} {binding.Source}\nConverter: {d.Converter} {d.ConverterParameter}\nBindingSource: {d.BindingSource}";
#endif
            return(c);
        }
        /// <summary>
        /// Creates a text box with data binding.
        /// </summary>
        /// <param name="d">The cell definition.</param>
        /// <returns>
        /// A TextBox.
        /// </returns>
        protected virtual FrameworkElement CreateTextBox(TextCellDefinition d)
        {
            var c = new TextBox
            {
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = d.HorizontalAlignment,
                MaxLength       = d.MaxLength,
                BorderThickness = new Thickness(0),
                Margin          = new Thickness(1, 1, 0, 0)
            };

            c.SetBinding(TextBox.TextProperty, this.CreateBinding(d));
            this.SetIsEnabledBinding(d, c);
            this.SetBackgroundBinding(d, c);
            return(c);
        }
        /// <summary>
        /// Creates a text box with data binding.
        /// </summary>
        /// <param name="d">The cell definition.</param>
        /// <returns>
        /// A TextBox.
        /// </returns>
        protected virtual FrameworkElement CreateTextBox(TextCellDefinition d)
        {
            var c = new TextBox
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = d.HorizontalAlignment,
                MaxLength = d.MaxLength,
                BorderThickness = new Thickness(0),
                Margin = new Thickness(1, 1, 0, 0)
            };

            c.SetBinding(TextBox.TextProperty, this.CreateBinding(d));
            this.SetIsEnabledBinding(d, c);
            this.SetBackgroundBinding(d, c);
            return c;
        }