This is a migrated thread and some comments may be shown as answers.

Property Grid TextWrap

5 Answers 386 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Carlitos
Top achievements
Rank 1
Carlitos asked on 07 Mar 2016, 05:45 AM

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

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Mar 2016, 11:08 AM
Hello Carlitos,

Thank you for writing.

I think that the Help bar would be useful for displaying an additional description 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
0
Carlitos
Top achievements
Rank 1
answered on 08 Mar 2016, 02:19 PM

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

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Mar 2016, 02:56 PM
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
0
Carlitos
Top achievements
Rank 1
answered on 09 Mar 2016, 12:55 AM

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

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Mar 2016, 01:16 PM
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 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.
Tags
PropertyGrid
Asked by
Carlitos
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Carlitos
Top achievements
Rank 1
Share this question
or