Property Grid TextWrap

6 posts, 0 answers
  1. Carlitos
    Carlitos avatar
    18 posts
    Member since:
    Nov 2015

    Posted 06 Mar Link to this post

    Hi, 

    I have a Property Grid. One of the Items states a read-only description. The describes what the object was created for. I.e. say it's a report, it will say something as: "This report was created in order to show sales history, comments and manufacturing information to assist sales reps in their quotes." The length is way to big for the height or width of the cell. So I am trying to make this particular property to be wrapped, or show an ellipses so that the user can expand the field and read the whole Description. I could also work with a tooltip but I would need the tooltip to be sized and scrollable in case the description is too long. 

    This property is read-only. 

    Regards, 

     

    Carlitos

  2. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 08 Mar Link to this post

    Hello Carlitos,

    Thank you for writing.

    I think that the Help bar would be useful for displaying an additional description for the property. Please refer to the following help article: http://docs.telerik.com/devtools/winforms/propertygrid/features/help-bar

    However, you can subscribe to the ItemFormatting event and either set the PropertyGridItemElement.ValueElement.AutoEllipsis property or the PropertyGridItemElement.ValueElement.TextWrap property to true in order to achieve the desired behavior.
    private void radPropertyGrid1_ItemFormatting(object sender, Telerik.WinControls.UI.PropertyGridItemFormattingEventArgs e)
    {
        PropertyGridItemElement el = e.VisualElement as PropertyGridItemElement;
        if (el!=null)
        {
         // el.ValueElement.AutoEllipsis = true;
            el.ValueElement.TextWrap = true;
        }
    }

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    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 WinForms is Visual Studio 2017 Ready
  4. Carlitos
    Carlitos avatar
    18 posts
    Member since:
    Nov 2015

    Posted 08 Mar in reply to Dess Link to this post

    Hi Dess, 

    Thanks for the reply. What I intend to do is wrap the value of the property. Please look at my screenshot attached. I am already decorating the object property's with the Description Attribute. This wraps just fine in the Help Section. What I am looking for is to wrap the "cell" for the property grid's value. Not all values need wrapping. For this particular object, it's basically only the Description Property as shown in the screenshot. 

    Thanks, 

    Carlitos

  5. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 08 Mar Link to this post

    Hello Carlitos,

    Thank you for writing back. 

    In order to wrap a specific property value, you can use the approach demonstrated in my previous post. I have attached a sample project for your convenience.

    I hope this information helps. If you have any additional questions, please let me know.

     Regards,
    Dess
    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
  6. Carlitos
    Carlitos avatar
    18 posts
    Member since:
    Nov 2015

    Posted 08 Mar in reply to Dess Link to this post

    I understand what you mean now. How can I control the height of that particular property row? Or will it adjust all the row of all properties? 

    Is it possible to evaluate the content of the ValueElement? I.e. in order to Wrap = true when the text.length > 80

  7. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 09 Mar Link to this post

    Hello Carlitos,

    Thank you for writing back. 

    Currently, you can change the height for all items by setting the PropertyGridElement.PropertyTableElement.ItemHeight property. We already have a feature request to add support for different height for each item. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready