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

Property Grid Group Order

11 Answers 460 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 22 Feb 2013, 11:40 PM
I'm using RadPropertyGrid to display multiple groups of properties & need to know how to: Control the Display Order of the Groups.

I define the PropertyDefinitions in the order in which I want them in in XAML, but the groups don't display in either alphabetical or
the order I define them.

How can I fix this in XAML or code-behind?

Alan

11 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 26 Feb 2013, 04:15 PM
Hi Alan,

Will it be possible to clarify a bit what is your exact requirement - do you want to sort the groups or the property definitions inside them ?  

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alan
Top achievements
Rank 1
answered on 26 Feb 2013, 07:47 PM
Sort the groups themselves.

I can already use the OrderIndex to sort the items within the groups.

Is there OrderIndex for groups as well?

Alan
0
Maya
Telerik team
answered on 27 Feb 2013, 02:43 PM
Hi Alan,

You can try specifying the Order attribute of the properties in each group so that their group's order correspond to the required one. I am attaching a sample project illustrating how you can order groups - Group 3, Group 2, Group 1 instead of the default order.

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alan
Top achievements
Rank 1
answered on 13 Mar 2013, 05:39 PM
Maya,

Thanks for this.

Unfortunately I must now create PropertyDefinition in XAML as data-annotations and automatic
property definition creation can't do some other things I want to do.

Is there way in XAML to force the group order?

Thanks,
 Alan
0
Maya
Telerik team
answered on 14 Mar 2013, 04:53 PM
Hello Alan,

You can try setting OrderIndex property of the property definitions. For example:

<telerik:PropertyDefinition OrderIndex="0" />
 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alan
Top achievements
Rank 1
answered on 15 Mar 2013, 06:56 PM
Maya,

That doesn't work as the OrderIndex only specifies the order of property items within a group.

What I need to do is set the order of the groups themselves.
See original question and your reply for more info on what I want to do.

Alan
0
Maya
Telerik team
answered on 18 Mar 2013, 12:34 PM
Hi Alan,

I might be missing something here, but I managed to get the same behavior as the one with data annotations by setting OrderIndex property of the property definitions,. Could you check the updated sample to verify whether this is the behavior that you require ?  

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Martin
Top achievements
Rank 2
answered on 22 Mar 2013, 02:12 PM
The PG really needs a group-order property, the example you have provided makes it's impossible to order the properties in a group.
0
Maya
Telerik team
answered on 25 Mar 2013, 02:36 PM
Hi Martin,

Currently, such functionality cannot be implemented without breaking a lot of the existing features and the  way property grid works. The only thing to do is to follow the approach suggested above - to specify the order indices of the property definitions/ properties.

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Martin
Top achievements
Rank 2
answered on 25 Mar 2013, 02:41 PM
Right now I am doing this

private readonly Dictionary<string, PropertyDefinition> _propertyDefinitions = new Dictionary<string, PropertyDefinition>
         {
             // common
            {"Name",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_Name,GroupName = CommonGrp,OrderIndex = 1}},
            {"DisplayText",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_Displaytext,GroupName = CommonGrp,OrderIndex = 2}},
            {"IsRequired",new PropertyDefinition{DisplayName = Properties.Resources.InputField_IsRequired,GroupName = CommonGrp,OrderIndex = 3}},
            {"RequiredCondition",new PropertyDefinition{DisplayName = Properties.Resources.InputField_RequiredCondition,GroupName = CommonGrp,OrderIndex = 4}},
            {"IsVisible",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_IsVisible ,GroupName = CommonGrp,OrderIndex = 5}},
            {"VisibleCondition",new PropertyDefinition{DisplayName = Properties.Resources.InputField_VisibleCondition ,GroupName = CommonGrp,OrderIndex = 6}},
            {"IsReadOnly",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_IsReadOnly ,GroupName = CommonGrp,OrderIndex = 7}},
            {"ReadOnlyCondition",new PropertyDefinition{DisplayName = Properties.Resources.InputField_ReadOnlyCondition ,GroupName = CommonGrp,OrderIndex = 8}},
            {"ExpressionId",new PropertyDefinition{DisplayName = Properties.Resources.InputField_ExpressionId ,GroupName = CommonGrp,OrderIndex = 9}},
            {"DefaultValue",new PropertyDefinition{DisplayName = Properties.Resources.InputField_DefaultValue ,GroupName = CommonGrp,OrderIndex = 10}},
            {"Index",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_Index ,GroupName = CommonGrp,OrderIndex = 11}},
 
             // Layout
            {"Height",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_Height ,GroupName = LayoutGrp,OrderIndex = 20}},
            {"Width",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_Width,GroupName = LayoutGrp,OrderIndex = 21}},
            {"Left",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_Left,GroupName = LayoutGrp,OrderIndex = 22}},
            {"Top",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_Top,GroupName = LayoutGrp,OrderIndex = 23}},
            {"Alignment",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_Alignment,GroupName = LayoutGrp,OrderIndex = 24}},
            {"LabelWidth",new PropertyDefinition{DisplayName = Properties.Resources.InputField_LabelWidth,GroupName = LayoutGrp,OrderIndex = 25}},
            {"UseDynamicWidth",new PropertyDefinition{DisplayName = Properties.Resources.PropertyField_UseDynamicWidth,GroupName = LayoutGrp,OrderIndex = 26}},
            {"Layout",new PropertyDefinition{DisplayName = "xLayout",GroupName = LayoutGrp,OrderIndex = 27}},
            {"FlowDirection",new PropertyDefinition{DisplayName = Properties.Resources.GroupBox_FlowDirection,GroupName = LayoutGrp,OrderIndex = 28}},
            {"Multiline",new PropertyDefinition{DisplayName = Properties.Resources.TextBox_Multiline,GroupName = LayoutGrp,OrderIndex = 29}},
         };
0
Maya
Telerik team
answered on 26 Mar 2013, 07:11 AM
Hello Martin,

As far as I can see, you are setting the order index of the properties, so I am guessing you managed to display them as required. Am I right or am I missing something ?

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
PropertyGrid
Asked by
Alan
Top achievements
Rank 1
Answers by
Maya
Telerik team
Alan
Top achievements
Rank 1
Martin
Top achievements
Rank 2
Share this question
or