I am using below code. But ... applied to Column header instead of apply to cell content of column. I want to apply it Text.
<igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowResize="True" AllowEdit="False" CellClickAction="SelectRecord" ExpandableFieldRecordHeaderDisplayMode="NeverDisplayHeader" ExpandableFieldRecordExpansionMode="ShowExpansionIndicatorIfSiblingsExist" LabelClickAction="SortByMultipleFields" LabelTextAlignment="Center" LabelTextTrimming="CharacterEllipsis" LabelTextWrapping="NoWrap" /> </igDP:XamDataGrid.FieldSettings>
Can anyone will guide on this?
Hello,
Thank you for your post. I have been looking into the functionality that you are trying to achieve and in order to allow TextTrimming to the Cells in the XamDataGrid, you can set the trimming to the editors that are used in the cells. The LabelTextTrimming property of the FieldSettings, sets the text trimming of the LabelPresenter of the Field that has this FieldSettings object. You can see detailed information regarding the LabelTextTrimminf property here in our documentation: http://help.infragistics.com/NetAdvantage/WPF/2012.1/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v12.1~Infragistics.Windows.DataPresenter.FieldSettings~LabelTextTrimming.html I have created a sample application for you that demonstrates how you can enable the TextTriming of the XamTextEditor, which is used by default, for all properties of type string in the data bound to the XamDataGrid. The sample application uses an approach, where the Template property of the editor is modified and the TextTrimming of the SimpleTextBlock is set. Another approach is to create a style for the XamTextEditor and in the Resources of the Style to add a Style for the SimpleTextBlock as follow:
... xmlns:igWindows="http://infragistics.com/Windows" ... <Style TargetType="{x:Type igEditor:XamTextEditor}"> <Style.Resources> <Style TargetType="{x:Type igWindows:SimpleTextBlock}"> <Setter Property="TextTrimming" Value="CharacterEllipsis"/> </Style> </Style.Resources> </Style>
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Is it possible to do this with the xamMaskedEditor? We have numeric fields with formatting and it is important that if the column is too narrow to not truncate and show confusing values but instead show the ellipsis to indicate there is more there.
Hello Ingenito,
I am very glad that the approach I have suggested was helpful for you. If you need any further assistance please do not hesitate to ask.
This was gold Krasimir. Thank you.
Thank you for your reply. I have been looking into it and I can suggest using the same approach as for the XamTextEditor, for adding a style for the SimpleTextBlock to the Resources of the XamMaskedEditor. Here is how you can achieve the text trimming for the XamMaskedEditor:
Xaml:
<igDP:XamDataGrid Name="xamDataGrid1" BindToSampleData="True"> <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igEditor:XamTextEditor}"> <Style.Resources> <Style TargetType="{x:Type igWindows:SimpleTextBlock}"> <Setter Property="TextTrimming" Value="CharacterEllipsis"/> </Style> </Style.Resources> </Style> <Style TargetType="{x:Type igEditor:XamMaskedEditor}" x:Key="MaskEditorTRimming"> <Style.Resources> <Style TargetType="{x:Type igWindows:SimpleTextBlock}"> <Setter Property="TextTrimming" Value="CharacterEllipsis"/> </Style> </Style.Resources> <Setter Property="Mask" Value="{}{double:12.3}"/> </Style> </igDP:XamDataGrid.Resources> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:Field Name="name" Width="40"/> <igDP:Field Name="department" Width="40"/> <igDP:Field Name="salary" Width="40"> <igDP:Field.Settings> <igDP:FieldSettings EditorStyle="{StaticResource MaskEditorTRimming}"/> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="email" Width="40"/> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>