Edit this page

Nested Properties

RadPropertyGrid can show nested PropertyDefinitions. In order to enable the nested properties support you need to set RadPropertyGrid's NestedPropertiesVisibility property to "Visible". That way you will be able to modify any editable child properties of reference types.

Example 1: Setting NestedPropertiesVisibility

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

Example 2: Preparing sample data

DataContext = new Order()
{
    OrderDate = new DateTime(1996, 7, 5),
    ShippedDate = new DateTime(1996, 8, 16),
    ShipAddress = "Luisenstr. 48",
    ShipCountry = "Germany",
    ShipName = "Toms Spezialitaten",
    ShipPostalCode = "44087",
    Employee = new Employee()
    {
        FirstName = "Nancy",
        LastName = "Davolio",
        Title = "Sales Representative",
        HomePhone = "(206) 555-9857",
        Department = new Department()
        {
            Country = "USA",
            ID = 1
        }
    },
};
DataContext = New Order() With {
    .OrderDate = New DateTime(1996, 7, 5),
    .ShippedDate = New DateTime(1996, 8, 16),
    .ShipAddress = "Luisenstr. 48",
    .ShipCountry = "Germany",
    .ShipName = "Toms Spezialitaten",
    .ShipPostalCode = "44087",
    .Employee = New Employee() With {
        .FirstName = "Nancy",
        .LastName = "Davolio",
        .Title = "Sales Representative",
        .HomePhone = "(206) 555-9857",
        .Department = New Department() With {
            .Country = "USA",
            .ID = 1
        }
    }
}

For a full example please check the Nested Properties demo about NestedPropertyDefinitions.

You can define a nested property like so:

Example 3: Defining nested property

<telerik:RadPropertyGrid x:Name="PropertyGrid1">
    <telerik:RadPropertyGrid.PropertyDefinitions>
        <telerik:PropertyDefinition Binding="{Binding Employee}">
            <telerik:PropertyDefinition.NestedProperties>
                <telerik:PropertyDefinition DisplayName="First name" Binding="{Binding FirstName}"/>
            </telerik:PropertyDefinition.NestedProperties>
        </telerik:PropertyDefinition>
    </telerik:RadPropertyGrid.PropertyDefinitions>
</telerik:RadPropertyGrid>

After Q1 2012 searching in the nested hierarchy is supported.

Before Q1 2012 the NestedPropertiesVisibility property has modes FlatMode and NestedPropertiesMode.

See Also