private static void UpdateText(DataGridColumn column, SearchBox filterTextBox) { if (!filterTextBox.IsFocused) { filterTextBox.Text = TextFilterHelper.GetTextFromState(column); } }
private SearchBox CreateTextBoxFilter(DataGridColumn column) { var filterTextBox = new SearchBox(); filterTextBox.Tag = column; filterTextBox.Text = TextFilterHelper.GetTextFromState(column); filterTextBox.SetBinding(SearchBox.BackgroundProperty, column.DataGrid, dg => dg.RowBackground); filterTextBox.SetBinding(SearchBox.ForegroundProperty, column.DataGrid, dg => dg.RowForeground); filterTextBox.SetBinding(SearchBox.BorderBrushProperty, column.DataGrid, dg => dg.BorderBrush); filterTextBox.SetBinding(SearchBox.FocusBrushProperty, column.DataGrid, dg => dg.SelectedBackground); filterTextBox.SetBinding(SearchBox.MouseOverBrushProperty, column.DataGrid, dg => dg.MouseOverBrush); return(filterTextBox); }