Text wrapping in edit mode

4 posts, 0 answers
  1. Patrick
    Patrick avatar
    55 posts
    Member since:
    Jun 2008

    Posted 23 Jul 2015 Link to this post

    I have a grid which displays a text field which can be large. This is set to wrap and does visualize correctly which means that the row height increases to allow the cell text to wrap. However when the cell is edited then the height returns to default, which is essentially one row of text high.

    I would like the cell to be able to be edited in wrap mode as well. Is this possible?

  2. Stefan X1
    Admin
    Stefan X1 avatar
    521 posts

    Posted 27 Jul 2015 Link to this post

    Hello Patrick,

    You can achieve this by defining a Style targeting the editor(the default one is a TextBox element) of GridViewDataColumn and set it through EditorStyle property. Please check the code snippet below:
    <Style TargetType="TextBox"
           x:Key="TextBoxEditorStyle">
        <Setter Property="TextWrapping" Value="Wrap"/>
    </Style>
    <telerik:GridViewDataColumn EditorStyle="{StaticResource TextBoxEditorStyle}"/>

    Can you please give it a try and let me know should you need further assistance?

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Patrick
    Patrick avatar
    55 posts
    Member since:
    Jun 2008

    Posted 27 Jul 2015 in reply to Stefan X1 Link to this post

    Yes this does work. Thank you very much.

    In a future version can this be incorporated automatically or at least through a setting? I would imagine if people visualize in wrapped mode then they would expect to edit in wrapped mode as well.

  5. Stefan X1
    Admin
    Stefan X1 avatar
    521 posts

    Posted 29 Jul 2015 Link to this post

    Hi Patrick,

    I am glad that the proposed solution worked for you.

    As to your request, please note, that various editors can be defined for GridViewDataColumn, so handling the TextWrapping property is too specific.

    Moreover, even if such logic is added for the default editor of GridViewDataColumn, this may turn into a breaking change for a lot of our clients, so we cannot commit to implementing it.

    I suggest you using the approach suggested in my previous post, as using the EditorStyle property of GridViewDataColumn is applicable for any editor defined.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top