2

I want to set TextTrimming on TextBlock.

<Style TargetType="{x:Type dg.CellValuePresenter}">
  <Setter Property="ContentTemplate" Value="{StaticResource Tmp}" />
</Style>

My template:

<DataTemplate x:Key="Tmp">
  <ContentPresenter Content="{Binding}" >
    <ContentPresenter.Resource>
      <Style TargetType="{x:Type TextBlock}">
        <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
      </Style>
    </ContentPresenter.Resource>
  </ContentPresenter>
</DataTemplate>

Content Presenter is XamTextEditor from Infragistic:

<Style TargetType="{x:Type igEditors:XamTextEditor}">
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
        <TextBlock/>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

Setter from DataTemplate doesn't work. Do you know how to set this property?

How can I set TextTrimming property in Textblock of XamTextEditor cudtom style? I cannot do this in this style because it is used in other datatemplates where texttrimming must be turn off. So I tried to set it in DataTemplate but it not work (i see in snoop that it is set to none)

Unfortunately I cannot show more code because I don't have access to internet on dev and write down more code is time consuming :/

netmajor
  • 6,507
  • 14
  • 68
  • 100
  • Please provide a more specific problem description than "doesn't work". Please also provide a good [mcve] that reliably reproduces the problem. – Peter Duniho Dec 05 '15 at 05:34

1 Answers1

0

I'm not sure if I get your problem completely. But If you are using explicit column definition. Then instead of CellvaluePresenter try create a EditorStyle For any column type(I've done it for string type column so the editor would be XamTextEditor)

<!--(xmlns:igWindows="http://infragistics.com/Windows")-->


<Style TargetType="{x:Type igEditors:XamTextEditor}" x:Key="DefaultXamDateTimeEditor">
  <Style.Resources >
         <Style TargetType="{x:Type igWindows:SimpleTextBlock}" >
                <Setter Property="TextTrimming" Value="CharacterEllipsis" />
         </Style>
   </Style.Resources>
</Style>

And use this style as columns EditorStyle. It should work in XamDatagrid as this is working for me. Please post specific situation If I didn't get the question right.

Kylo Ren
  • 8,551
  • 6
  • 41
  • 66