protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem) { var box = new AutoCompleteBox { FilterMode = FilterMode, IsTextCompletionEnabled = true, BorderThickness = new Thickness(), Background = Brushes.White, Padding = new Thickness() }; if (Binding != null && !DesignerProperties.GetIsInDesignMode(box)) { box.ItemsSource = ItemsSource; var itemTemplate = ItemTemplate; if (itemTemplate == null && !string.IsNullOrEmpty(DisplayMemberPath)) { itemTemplate = GetItemTemplate(DisplayMemberPath); } box.ItemTemplate = itemTemplate; if (!string.IsNullOrEmpty(DisplayMemberPath)) { box.ValueMemberBinding = new Binding(DisplayMemberPath); } else if (!string.IsNullOrEmpty(ValueMemberPath)) { box.ValueMemberPath = ValueMemberPath; } box.SetBinding(AutoCompleteBox.TextProperty, Binding); } return(box); }