Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1155
About wrap text
posted

here are two ways I implement the wrap text for the cell.

I have button and when I click the button the warp text style will be applied to the cells.

However, both two ways have a weak point.

after impement it as Way1, all the cells are editable although I handle the StartEditing event.

after impement it as Way2, I first decrease the row height until the text is cut and then apply the wrap text style, the text is cu.

Could you please tell me how to fix this?


Way1:

<igDP:XamDataGrid>

<igDP:XamDataGrid.Resources>
    <Style TargetType="{x:Type igDP:CellValuePresenter}">
       
<Setter Property="Template">
           
<Setter.Value>
               
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                   
<igEditors:XamTextEditor Margin="{TemplateBinding Padding}" 
                       
Width="{TemplateBinding Width}" 
                       
Height="{TemplateBinding Height}"
                       
VerticalScrollBarVisibility="Auto"
                       
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"
                       
TextWrapping="Wrap"
                       
Background="Transparent"
                       
HorizontalAlignment="Stretch"
                       
VerticalAlignment="Stretch"/>
               
</ControlTemplate>
           
</Setter.Value>
       
</Setter>
   
</Style>

Way2:

<Style TargetType="{x:Type igDP:XamTextEditor }">
<Setter Property="TextWrapping" Value="Wrap"/>

<Setter Property=“HorizontalAlignment Value="Stretch"/>
<Setter Proerty="
VerticalAlignment" value="Stretch"/>


   
</Style>
</igDP:XamDataGrid.Resources>

</igDP:XamDataGrid>

Parents
  • 1155
    posted

    In way2, I want the height of the XamTextEditor changed with the CellValuePresenter, althougth I add one setter like this(maybe the format is not correct in this reply), it still doesn't work:

    <Setter Property="Height" Value="{Binding Path=ActualHeight, RelativeSource={RelativeSource FindAncester, Type={x;Type CellValuePresenter}}}"/>

Reply Children
No Data