Hello Telerik,
I have two small questions about PropertyGrid.
1. Is possible to have a hyperlink in one Property Value (not entire column, just one or several values to be URL)
2. I've tested the nice feature of grouping. Can I have more sub-groups there, or expandable one, eg:
Distributors (main group)
Belnor ( sub group)
Property - Value
Property - Value
Kirkwald (sub group)
Property - Value
Property - Value
Thanks in advance,
3 Answers, 1 is accepted
Thank you for writing.
The flexible mechanism of RadPropertyGrid gives you the opportunity to create custom items with the desired nested elements. Thus, you can use a RadLabelElement with underlined text on which Click event you can perform the required action. Please refer to our PropertyGrid >> Custom items help article.
When you need to display a property of complex type composed of several properties, it is suitable to use the ExpandableObjectConverter:
public Form1(){ InitializeComponent(); this.radPropertyGrid1.SelectedObject = new MainObject(new FirstLevel( new SecondLevelA(1,11),new SecondLevelB(2,22)));}public class MainObject{ [TypeConverter(typeof(ExpandableObjectConverter))] public FirstLevel mainProp { get; set; } public MainObject(FirstLevel mainProp) { this.mainProp = mainProp; }}public class FirstLevel{ [TypeConverter(typeof(ExpandableObjectConverter))] public SecondLevelA propA { get; set; } [TypeConverter(typeof(ExpandableObjectConverter))] public SecondLevelB propB { get; set; } public FirstLevel(SecondLevelA propA, SecondLevelB propB) { this.propA = propA; this.propB = propB; }}public class SecondLevelA{ public int A { get; set; } public int AA { get; set; } public SecondLevelA(int a, int aA) { this.A = a; this.AA = aA; }}public class SecondLevelB{ public int B { get; set; } public int BB { get; set; } public SecondLevelB(int b, int bB) { this.B = b; this.BB = bB; }}I hope this information helps. Should you have further questions, I would be glad to help.
Dess
Telerik
Hello Dess,
Thanks for answer. I solve'it by using PropertyStore and decorating sub-classes with ExpandableObjectConverter which is ok but read-only argument still not working for sub-categories.
I wonder if a class can be write for (so complicated) PropertyGrid working with run-time elements. It's somehow time consuming for me as amateur and keeps distracting me for main application goal.
Would be very nice to have something like
AddNode(name, description, arguments)
AddSubNode(node,etc, etc)
Thank you for writing back.
In order to make a property item read-only, you can specify the ReadOnly attribute for the certain property in you class. It can not be edited on my end (property "B"). Please refer to the attached gif file. Alternatively, in order to disable editing for a specific property you can cancel the RadPropertyGrid.Editing event.
RadPropertyGrid can be populated with data by using two approaches: setting the SelectedObject property to a custom object, or to a RadPropertyStore. It is up to which approach is suitable for your case.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik
