How to: Create a Master-Detail Grid

  • 3 minutes to read

The following example demonstrates how to create a master-detail grid.

<Window x:Class="MasterDetailInside.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
        xmlns:local="clr-namespace:MasterDetailInside" 
        Title="Window1" Height="500" Width="700">
    <Window.DataContext>
        <local:ViewModel/>
    </Window.DataContext>
    <dxg:GridControl x:Name="grid" ItemsSource="{Binding Path=Data}" AutoGenerateColumns="AddNew">
        <dxg:GridControl.DetailDescriptor>
            <dxg:DataControlDetailDescriptor ItemsSourceBinding="{Binding Data}">
                <dxg:GridControl AutoGenerateColumns="AddNew"/>
            </dxg:DataControlDetailDescriptor>
        </dxg:GridControl.DetailDescriptor>
    </dxg:GridControl>
</Window>
See Also