Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
XamDataGrid filter styles
posted

I am adding a filter option to my XamDataGrid and I was wondering if there is anyway to restyle either the regular textblock filter or the excel dialog filter. For the textblock filter is there a way to update the operators (Equals, Begins with, etc.) by removing the ones we don't want? Also is it possible to change the icons for some of the options. I don't think I have access to the default XamDataGrid styles so I can't update the default templates for those controls.

Parents
No Data
Reply
  • 16495
    Offline posted

    Hello Jakub,

    Thank you for your support request.

    You find the default style for XamDataGrid from the following location on your machine:  C:\Program Files (x86)\Infragistics\2015.2\WPF\DefaultStyles\DataPresenter.  The style for FilterCellValuePresenter   is located in file with name “DataPresenterGeneric_Express.xaml”, so you would be able to copy and modify it in order to change the visual appearance of filter cells..  You can take a look at the following forum thread where  Andrew has provided an example of how to change the  style of filter operators and modify the icons:

    http://www.infragistics.com/community/forums/t/89580.aspx

    About  the requirement for updating the operators(Equals, Starts With,  … ). They are resource strings, so you can easily  modify the value that is display to the end user. You can find more details from the following forum thread:

    http://www.infragistics.com/community/forums/t/38554.aspx

    for example you can use the SetCustomizedString method:

    Infragistics.Windows.Resources.Customizer.SetCustomizedString("ComparisonOperator_Equals", "Custom Equals");

    If you would like to hide some item, you can create style for ComboBoxItem in order to handle it’s Loaded event and set  the Visibility property depending on it’s value:

    <Style TargetType="{x:Type ComboBoxItem}">
                        <EventSetter Event="Loaded" Handler="operators_Loaded"/>
    </Style>


    private void operators_Loaded(object sender, RoutedEventArgs e)
     {
                if ((sender as ComboBoxItem).Content.ToString() == "Starts with")
                    (sender as ComboBoxItem).Visibility = Visibility.Collapsed;
      }


    I have attached simple project that illustrates this approache, please take a look and let me know if you require any further assistance regarding this matter.

    FilterStyles.zip
Children