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.
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.
So i was able to find the style files and modify various styles for the filtering stuff. I was wondering if it would be possible to restyle Excel filter popup when I use FilterLabelIconDropDownType="MultiSelectExcelStyle". I was able to modify RecordFilterTreeControl to change the inner tree but the outer popup window wasn't affected.
I am glad that you have managed to modify the styles you wish.
I am not sure that I understood correctly what is the issue here. Would you please provide more details and about what you have in mind with outer popup, a screenshot may help. This way I would be able to investigate this requirement for you. The following forum thread can be of help to you:
http://www.infragistics.com/community/forums/t/67586.aspx
It will be great if you could share a sample project that illustrates the behavior you are trying to achieve.
Looking forward to hearing from you.
I added a picture of the filter window I would like to change. I would like to be able to change all the styles in this window but keep the functionality the same. I want to change stuff like the background colors, textbox style, removing that gray bar at the bottom, etc.
I created a Style for the FieldMenuItem in the XamDataGrid’s Resources and handled its Loaded event to achieve the functionality you want:
<igWPF:XamDataGrid.Resources>
<Style TargetType="{x:Type igWPF:FieldMenuItem}">
<EventSetter Event="Loaded" Handler="FilterLoaded"/>
</Style>
</igWPF:XamDataGrid.Resources>
In the event handler I find the element I wish to re-style from the visual tree by using our Utilities class. I can suggest you use a UI spy tool like Snoop in order to explore the visual tree of the FilterMenu and find the elements you want to re-style. You can find more details for this tool from the following forum thread:
http://www.infragistics.com/community/forums/t/97514.aspx
You can observe similar approaches from these forum threads:
http://www.infragistics.com/community/forums/t/65364.aspx
http://www.infragistics.com/community/forums/t/66564.aspx
I have attached sample application in order to show you how you can implement my suggestions and achieve the behavior you wish.
Please let me know if this helps you or you need further assistance on this matter.