I've tried the search control and it works.
However I had to make 2 changes on your code not to have crashes on my own example.
First of all:
static SearchControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SearchControl), new FrameworkPropertyMetadata(typeof(SearchControl)));
}
public SearchControl()
{
}
I have inserted the static constructor and the OverrideMetadata is called inside it. Otherwise, the second time you create the same control you'd have a crash.
Secondly, I had to make this change:
private void OnComboBoxSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
if (e.RemovedItems.Count == 0 || e.AddedItems.Count == 0)
return;
var oldItem = e.RemovedItems[0];
var newItem = e.AddedItems[0];
if (oldItem == null || newItem == null)
return;
var oldGrid = this.GetDataGrid(oldItem.ToString());
var newGrid = this.GetDataGrid(newItem.ToString());
oldGrid.SearchHelper.ClearSearch();
newGrid.SearchHelper.AllowFiltering = (bool)this.ApplyFilterCheckBox.IsChecked;
newGrid.SearchHelper.Search(SearchTextBox.Text);
}
Without the inserted red lines I had cases (closing the form) where e.AddedItems was empty and an IndexOfRangeException was thrown.
Now I have a question for you. This control seems to search for only Text cells. But what about searching also for combo-box value cells? Should it be possible ?
Have a nice day !