Property Grid Group Order

12 posts, 0 answers
  1. Alan
    Alan avatar
    25 posts
    Member since:
    Jan 2013

    Posted 22 Feb 2013 Link to this post

    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
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 26 Feb 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Alan
    Alan avatar
    25 posts
    Member since:
    Jan 2013

    Posted 26 Feb 2013 Link to this post

    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
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 27 Feb 2013 Link to this post

    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.

  6. Alan
    Alan avatar
    25 posts
    Member since:
    Jan 2013

    Posted 13 Mar 2013 Link to this post

    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
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 14 Mar 2013 Link to this post

    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.

  8. Alan
    Alan avatar
    25 posts
    Member since:
    Jan 2013

    Posted 15 Mar 2013 Link to this post

    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
  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 18 Mar 2013 Link to this post

    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.

  10. Martin
    Martin avatar
    39 posts
    Member since:
    Sep 2008

    Posted 22 Mar 2013 Link to this post

    The PG really needs a group-order property, the example you have provided makes it's impossible to order the properties in a group.
  11. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 25 Mar 2013 Link to this post

    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.

  12. Martin
    Martin avatar
    39 posts
    Member since:
    Sep 2008

    Posted 25 Mar 2013 Link to this post

    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}},
             };
  13. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 26 Mar 2013 Link to this post

    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.

Back to Top
UI for WPF is Visual Studio 2017 Ready