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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Customize FilterControl

Thread ID:

Created:

Updated:

Platform:

Replies:

132163 Aug 17,2017 01:24 PM UTC Oct 18,2017 04:44 PM UTC WPF 5
loading
Tags: SfDataGrid
Alessandro
Asked On August 17, 2017 01:24 PM UTC

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.

Balamurugan Rajaraman [Syncfusion]
Replied On 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 


Alessandro
Replied On 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.


Balamurugan Rajaraman [Syncfusion]
Replied On 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 


Alessandro
Replied On 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!


Muthukumar Kalyanasundaram [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;