Flatten nested properties?

2 posts, 0 answers
  1. BobB
    BobB avatar
    1 posts
    Member since:
    Apr 2017

    Posted 03 Apr Link to this post

    public class Employee
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Title { get; set; }
        public string HomePhone { get; set; }
    }
     
    public class Order
    {
        public string ShipAddress { get; set; }
        public string ShipName { get; set; }
        public string ShipPostalCode { get; set; }
        public string ShipCountry { get; set; }
        public Employee Employee { get; set; }
    }

     

    <telerik:RadPropertyGrid Item="{Binding}"
                                NestedPropertiesVisibility="Visible" />

     

    Is there a way to flatten the Employee class so it doesn't have to be "opened" to edit it? I would really like to have all the Employee class properties be on the same level as the shipping properties like in the image.

     


  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1201 posts

    Posted 03 Apr Link to this post

    Hi,

    You can use the AutogenerateBindgPaths property (Unbound mode of RadPropertyGrid) to define custom nested hierarchies. In this way you will be able to define a root level list of property definition, specifying binding paths to the nested properties. Here is an article that gives some more extensive info on the topic. It also contains a simple example.

    Regards,
    Ivan Ivanov
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top