Hi everybody.
I'm trying to make the text appear trimmed with ellipsis in text fields.
Adding the following style ao app / page / grid resources had no effect:
<Style TargetType="{x:Type igEditors:XamTextEditor}"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="TextBlock.TextTrimming" Value="CharacterEllipsis" /></Style>
Does anyone know how ti achieve it?
Many thanks,
Yaakov
OK, found a solution:
<Style TargetType="{x:Type igEditors:XamTextEditor}"> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}"> <Border x:Name="MainBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" > <!-- SSP 10/3/07 BR25672 Took the following code out of Border element above since the TextBlock below is already setting that value. We don't want to substract the padding twice. Margin="{TemplateBinding Padding}"--> <TextBlock x:Name="TextBlock" Margin="{TemplateBinding Padding}" Text="{TemplateBinding DisplayText}" TextWrapping="{TemplateBinding TextWrapping}"
TextTrimming="CharchterEllipsis"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" TextAlignment="{TemplateBinding TextAlignmentResolved}" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsEmbedded" Value="False"> <Setter TargetName="MainBorder" Property="CornerRadius" Value="1" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter></Style>
The template was taken from "C:\Program Files\Infragistics\NetAdvantage for WPF (Express) 2008 Vol. 2\DefaultStyles\Editors\EditorsGeneric_Express.xaml".
XamDataGrid uses an infragistics wrapped version of TextBlock called SimpleTextBlock(atleast for the rows). Any implicitly set style on TextBlock does not propagate to SimpleTextBlock, you need to set it on SimpleTextBlock
<Style TargetType="{x:Type igWpf:SimpleTextBlock}">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
</Style>