I've set the FilterOperandUIType to TextBox in my xaml code in the field settings for my XamDataGrid.
I would now like to set the Border of that TextBox to some color. The reason is that for users it's much easier to see that there is actually a textbox there they can click on and enter text. Without the border it's very hard to tell that there is a place they can click on and enter text.
I tried creating a style for the XamTextEditor and add it to the <igDp:XamDataGrid.Resources> but all that did was create a border around the filter textbox and it caused a border to be drawn around every cell that was in a text field.
How do I get just the Filter TextBox to have a border and not any of the cells in any of the fields?
Thanks for any help.
Hello Michael,
Setting up a style for XamTextEditor without a key will replace the default style for every editor in the grid. You can try styling the FilterCellValuePresenter instead:
<Style TargetType="{x:Type igDP:FilterCellValuePresenter}"> <Setter Property="BorderThickness" Value="1,1,1,1"/> <Setter Property="BorderBrush" Value="Red"/> </Style>
Should you have any further questions, please let me know.
Sincerely,
Tihomir TonevAssociate Software DeveloperInfragistics
Thanks for the reply and your code is close but it's not exactly what I want.
Your code puts a red border around the entire filter cell. I want to just put a border around the Textbox in the filter cell. Remember I set the FilterOperandUIType to TextBox. That is the textbox I want to put a border around.
Is there a way to do that?
Thanks
There is a XamTextEditor assigned for the tebox in this case. Generally the editor will be used to represent each text field(assigned by default by the grid), so to keep the styling in the filter area only, I can suggest the following solution:
<Style TargetType="{x:Type igDP:FilterCellValuePresenter}"> <Setter Property="Tag" Value="blub"/> </Style> <Style TargetType="{x:Type igWPF:XamTextEditor}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type igDP:FilterCellValuePresenter}}, Path=Tag}" Value="blub"> <Setter Property="BorderThickness" Value="1,1,1,1"/> <Setter Property="BorderBrush" Value="Red"/> </DataTrigger> </Style.Triggers> </Style>
I hope the above code puts the borders where you want them, if not please let me know.
Thank you this worked great.
Although you might want to think about adding a property that could access the XamTextEditor and the other UI types for the FilterCellValuePresenter in the future. Having to use a dummy trigger obviously works but I don't see why Ingragistics would not add a better way to access these controls in order to customize them.
Just a suggestion.
Anyway thank you again.
That is not a bad idea, and that's why we have the following section on our website:
https://www.infragistics.com/community/ideas