In a xamDataGrid I have a very narrow column - with a very small width - the label header is one character, something like "$".
When the user sorts by that column, an arrow appears indicating the sort order. We do not want to increase the column width just for the sorted icon.
Is there any way to not show the sorted icon for this column?
Hello,
Yes, you can do that by removing the SortIndicator from the style of the LabelPresenter or removing the triggers for the Visibility of the Sort Indicator. You can see the default style for the LabelPresenter in the DefaultStyles folder in the Infragistics directory on your computer.
Hope this helps,
Alex.
Hi Alex,
Thanks for the response - I'll try it out.
But just to make sure: would your solution remove the SortIndicator for all headers/columns? I need to remove the SortIndicator only for one specific narrow column.
In this case, you should set x:key to the style and apply the style only to that Field. If you do not set x:key, the style will be applied to all the fields.
<Style x:Key="NoSortIndicatorStyle" TargetType="{x:Type igDP:LabelPresenter}" >
....
and apply the style to the LabelPresenter in the Settings of the field like this:
<igDP:UnboundField Name="index" Label="index" BindingPath="CustomerName">
<igDP:UnboundField.Settings>
<igDP:FieldSettings LabelPresenterStyle="{StaticResource NoSortIndicatorStyle}"/>
</igDP:UnboundField.Settings>
</igDP:UnboundField>
Note: Type of the field : unbound or just Field makes no difference.
This worked well, thanks!
For reference if anyone is trying to do the same, here's what I did:
1) Did a BareGrep and found the style for "LabelPresenter" in:
C:\Program Files (x86)\Infragistics\NetAdvantage for .NET 2009.1\WPF\DefaultStyles\DataPresenterDataPresenterGeneric_Express.xaml
2) Copied the style to my resources:
<Style x:Key="NoSortIndicatorStyle" TargetType="{x:Type igDP:LabelPresenter}">...</Style>
3) Copied a couple of converters used by the above style to my resources:
<igDP:TextAlignmentToHorizontalAlignmentConverter x:Key="textAlignmentToHorizontalAlignmentConverter"/> <BooleanToVisibilityConverter x:Key="BoolToVisConverter"/>