C1FlexGrid DataTemplate Textbox Wrapping and Autosize

Posted by: Guy on 5 July 2022, 9:21 pm EST

  • Posted 5 July 2022, 9:21 pm EST

    Hi,
    We have a need to show C1FlexGrid column using a textbox. for that we use DataTemplate. now we have a need to TextWrap the content and to AutoSizeRows to show all the data.
    When using this scenario - AutoSizeRows DOES NOT WORK...

    Attached is a sample with 2 FlexGrids:
    1. Using our DataTemplate of Textbox - does not work.
    2. Not using a DataTemplate - works fine.

    Please advice.C1FlexGridWrapIssue.zip
  • Replied 5 July 2022, 11:14 pm EST

    Hi,

    Thanks for the sample.

    If you are adding a TextBox in Celltemplate with IsReadOnly="True". Then we suggests you to use TextBlock instead. Then Resize the rows of flexgrid when it loaded in the view.

    <c1:Column.CellTemplate>
    <DataTemplate>
    <TextBlock Text="{Binding First, Mode=OneWay}" Background="Transparent" TextWrapping="Wrap" />
    </DataTemplate>
    </c1:Column.CellTemplate>


    Please refer the attached modified sample for the same : C1FlexGridWrap_Mod.zip

    Best Regards,
    Nitin
  • Replied 7 July 2022, 3:33 am EST

    Hi Nitin,

    while it does work when using a TexBlock we still need to use a readonly TextBox.

    using a TextBox in Celltemplate with IsReadOnly="True" allows for text selection and copying (partial or full) - and that is required (it why we use it)...

    How can we still get it to work with a TexBox?
  • Replied 7 July 2022, 11:10 pm EST

    Hello Guy,

    We understood your scenario. But having TextBox in CellTemplate creating auto row size issue. So, that we have escalated this to the development team. We will get back to you once we have any update from them.[Internal tracking Id - C1XAML-29903]

    Best Regards,
    Nitin
  • Replied 7 July 2022, 11:21 pm EST

    Hello Guy,

    It seems like you are using C1 4.0 version controls. Can you consider upgrading to 4.6.2?
    We only fix critical issues in .Net 4.0

    Regards,
    Nitin
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels