We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Customize FilterControl

Hi, There is a possibility to change the text in the filter control??
I have see your example where you changed AscendingSortString and DescendingSortString but i don't find other string.
Thanks for support.

5 Replies

BR Balamurugan Rajaraman Syncfusion Team August 18, 2017 04:00 PM UTC

Hi Alessandro 
 
Thanks for contacting Syncfusion support. 
 
We have checked your query “How to change the Text in Filter control”. you can able to achieve this by using Resource file, here you can able to change the change the text of each control as per needed. Here we changed the text for the FilterControl in the Resource file as like the below snap shot. 
 
 
 
We have created the sample as per the requirement and attached that sample for your reference. You can able to get it from the below link 
 
 
Please refer the below link for getting more information about the usage of resource file in our SfDataGrid 
 
 
Regards, 
Balamurugan R 



AL Alessandro August 21, 2017 07:05 PM UTC

Hi, thanks for the answer, but i need to change the text of FilterControl runtime.

There is a possibility? I read a example where you change the text of "SortNumberAscending" via code, but i don't find others...

Thanks a lot for the support.



BR Balamurugan Rajaraman Syncfusion Team August 23, 2017 06:27 PM UTC

Hi Alessandro 
 
We are sorry for the inconvenience. 
 
Currently we didn’t have the direct support for change the content in the FilterControl. So we have make workaround to achieve your requirement by getting the child element in the FilterControl using the VisualTreeHelper as like the below code sample 
 
var sortDescending = FindDescendant((dependencyObject as Popup).Child, typeof(Button), "PART_SortDescendingButton"); 
((System.Windows.Controls.ContentControl)sortDescending).Content = "Sort in reverse"; 
var sortAscending = FindDescendant((dependencyObject as Popup).Child, typeof(Button), "PART_SortAscendingButton"); 
((System.Windows.Controls.ContentControl)sortAscending).Content = "Sort in forward"; 
                
var advance = FindDescendant((dependencyObject as Popup).Child, typeof(Button), "PART_AdvancedFilterButton"); 
((System.Windows.Controls.ContentControl)advance).Content = "Advance filtering"; 
var AdvanceFilter = FindDescendant((dependencyObject as Popup).Child, typeof(Button), "PART_ClearFilterButton"); 
((System.Windows.Controls.ContentControl)AdvanceFilter).Content = "clears"; 
var okbutton = FindDescendant((dependencyObject as Popup).Child, typeof(Button), "PART_OkButton"); 
((System.Windows.Controls.ContentControl)okbutton).Content = "okey"; 
var cancelButton = FindDescendant((dependencyObject as Popup).Child, typeof(Button), "PART_CancelButton"); 
((System.Windows.Controls.ContentControl)cancelButton).Content = "stop"; 
}), DispatcherPriority.ApplicationIdle); 
 
We have created the sample as per the above mentioned scenario to meet your requirement. You can able to get it from the below link. 
  
 
Regards, 
Balamurugan R 



AL Alessandro October 17, 2017 06:48 PM UTC

Hi, it's perfect thanks but i still have one problem:

I dont' find the string "Show rows where:" in the advanced filter control for edit it.

Thanks!



MK Muthukumar Kalyanasundaram Syncfusion Team October 18, 2017 04:44 PM UTC

Hi Alessandro, 
  
Thanks for the update. 
  
We have checked your query. You can achieve your requirement by customizing the style of “AdvancedFilterControl” as like below code. For your reference, we have attached sample in the below location. Could you please refer to it. 
  
Code Snippet: xaml 
  
<Style TargetType="{x:Type syncfusion:AdvancedFilterControl}"> 
    <Setter Property="MaxHeight" Value="275" /> 
    <Setter Property="Template"> 
        <Setter.Value> 
            <ControlTemplate TargetType="{x:Type syncfusion:AdvancedFilterControl}"> 
                <Grid Height="{TemplateBinding Height}"> 
. . . . . 
. . . . .  
                    <Grid Margin="30,0,4,4"> 
                        <Grid.RowDefinitions> 
                            <RowDefinition Height="*" /> 
                            <RowDefinition Height="*" /> 
                        </Grid.RowDefinitions> 
                        <TextBlock Grid.Row="0" 
                                    Margin="0,0,10,5" 
                                    HorizontalAlignment="Stretch" 
                                    VerticalAlignment="Center" 
                                    Text="Rows Displayed" /> 
. . . . . 
. . . . .  
               </ControlTemplate> 
            </Setter.Value> 
        </Setter> 
</Style> 
  
Code Snippet: C# 
  
private void Button_Click(object sender, RoutedEventArgs e) 
{ 
    // to display the custom text in AdvanceFilterControl  
    ResourceDictionary myResourceDictionary = new ResourceDictionary(); 
    myResourceDictionary.Source = new Uri("AdvanceFilterControl.xaml", UriKind.Relative); 
    Application.Current.Resources.MergedDictionaries.Add(myResourceDictionary); 
} 
  
  
  
Please let us know if you have any other questions. 
  
Regards, 
Muthukumar K 


Loader.
Live Chat Icon For mobile
Up arrow icon