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
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.
Dess
Telerik
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
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
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
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