For xamDataGrid, if I add a filter to one or more columns, the header filter will change from a filter with an arrow to a filter with an X.
If I want to use my own icon, how can I replace it? (the icon on the most left.)
Hello,
In this case we have:
<Button Style="{DynamicResource {x:Static igDP:DataPresenterBase.FilterRecordClearButtonStyleKey}}">
So in order to target it with a style, we need to do:
<Style TargetType="{x:Type Button}" x:Key="{x:Static igDP:DataPresenterBase.FilterRecordClearButtonStyleKey}">
I have modified the app to host 4 grids now. I have moved the style to App.xaml so all grids will use it. I have also modified the style in one of the grids, so the trigger of the style will change the icon of that grid.
Please check the sample and let me know if you need further help.
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics
2275.XDGCustomFilterIcon.zip
Let me take a Label style as an example.
<Style x:Key="customLabelStyle" TargetType="Label"> ... </Style>
User control A:
<Grid> ... some xaml markup... <Label Style="{StaticResource customLabelStyle}"/> </Grid>
UserControl B:
<Grid> ... some another xaml markup... <Label Style="{StaticResource customLabelStyle}"/> </Grid>In both places, <Label Style= ... />In this case, I put the following in a resource file:<Style x:Key="{x:Static dataPresenter:DataPresenterBase.FilterRecordClearButtonStyleKey}" TargetType="{x:Type Button}"> <Setter Property="Cursor" Value="Hand"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Image x:Name="FilterRecordIcon" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center" igWindows:Utilities.SnapElementToDevicePixels="True" Source="../Images/Filter.png"/> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="True"> <Setter TargetName="FilterRecordIcon" Property="Source" Value="../Images/FilterClear.png"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>I have several views with xamDataGrid, I don't know where and how to use this shared style.
In the sample I have changed the image for the ClearFilterButton as in the image attached, as the request was targeting the icon on the left:
The key for this is x:Key="{x:Static igDP:DataPresenterBase.FilterRecordClearButtonStyleKey}"
In case you meant another filter icon, could you please post an image where it is highlighted, so I can assist you with it.
Thanks a lot.
I have several views with the xamDataGrid. So I think I should put this type to Resource file, then assign this style to a property. I tried "ClearButtonStyle", it is not the correct property name. What's the property name for this style?
All styles for XamDataGrid are located in the installation directory of your project, in the default styles folder. From there, you can take the template used for the ClearButton and change the image used to one of your liking.
I made a sample project for further reference.
Should you have any other questions, please let me know.
XDGCustomFilterIcon.zip