SearchPanel Text Background & Foreground

0 Answers 22 Views
GridView
Dan
Top achievements
Rank 1
Iron
Dan asked on 17 Oct 2023, 03:01 PM

How can i change the Search Panel Text Background and Foreground for a RadGridView

 

Dinko
Telerik team
commented on 18 Oct 2023, 05:50 PM

Hello Dan, 

To achieve this requirement, you can extract and modify the GridViewSearchPanelTemplate located in the Telerik.Windows.Controls.GridView.xaml file.

In case you don't want to extract the control template you can use Visual Tree Helpers. You could subscribe to the Loaded event of the RadGridView and in the C# code you can take the SearchPanel TextBox with x:Name="PART_SearchAsYouTypeTextBox". After taking the TextBox you can change the Background and Foreground properties to your desired color.

private void gridView_Loaded(object sender, RoutedEventArgs e)
{
	var searchTextBox = this.gridView.ChildrenOfType<TextBox>().FirstOrDefault(x => x.Name == "PART_SearchAsYouTypeTextBox");
	searchTextBox.Background = Brushes.Bisque;
	searchTextBox.Foreground = Brushes.HotPink;
}

For your convenience I prepared a sample solution where this logic is implemented.

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Dan
Top achievements
Rank 1
Iron
Share this question
or