Xceed DataGrid for WPF v7.2 Documentation
Using Routed View Properties
Welcome to Xceed DataGrid, Editors, and 3D Views for WPF v7.2 > Xceed DataGrid for WPF > Code Snippets > Using Routed View Properties

The following example demonstrates how to set routed view properties on detail configurations to change the width of their detail indicators as well as to fix columns and remove the fixed-column splitter.

XAML
Copy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
      xmlns:local="clr-namespace:Xceed.Wpf.Documentation">
  <Grid.Resources>
     <xcdg:DataGridCollectionViewSource x:Key="cvs_employees"
                                        Source="{Binding Source={x:Static Application.Current},
                                                    Path=Employees}" />
  </Grid.Resources>
  <xcdg:DataGridControl x:Name="EmployeesGrid"
                      ItemsSource="{Binding Source={StaticResource cvs_employees}}"
                      AutoCreateDetailConfigurations="True">
     <xcdg:DataGridControl.Columns>
        <xcdg:Column FieldName="Photo"
                     Visible="False" />
     </xcdg:DataGridControl.Columns>
     <xcdg:DataGridControl.DetailConfigurations>
        <xcdg:DetailConfiguration RelationName="Employee_Orders"
                                  Title="Employee Orders"
                                  xcdg:TableView.DetailIndicatorWidth="50"
                                  xcdg:TableView.FixedColumnCount="2">
           <xcdg:DetailConfiguration.Columns>
              <xcdg:Column FieldName="EmployeeID"
                           Visible="False" />
           </xcdg:DetailConfiguration.Columns>
           <xcdg:DetailConfiguration.DetailConfigurations>
              <xcdg:DetailConfiguration RelationName="Order_OrderDetails"
                                        Title="Order Details"
                                        xcdg:TableView.ShowFixedColumnSplitter="False"
                                        xcdg:TableView.DetailIndicatorWidth="50"/>
           </xcdg:DetailConfiguration.DetailConfigurations>
        </xcdg:DetailConfiguration>
     </xcdg:DataGridControl.DetailConfigurations>
  </xcdg:DataGridControl>
</Grid>
VB.NET
Copy Code
dataGridControl.AutoCreateDetailConfigurations = True
dataGridControl.Columns( "Photo" ).Visible = False
Dim detailConfiguration As New DetailConfiguration()
detailConfiguration.RelationName = "Employee_Orders"
detailConfiguration.Title = "Employee Orders"
detailConfiguration.Columns( "EmployeeID" ).Visible = False
detailConfiguration.SetValue( TableView.DetailIndicatorWidthProperty, 50 )
detailConfiguration.SetValue( TableView.FixedColumnCountProperty, 2 )
Dim childDetailConfiguration As New DetailConfiguration()
childDetailConfiguration.RelationName = "Order_OrderDetails"
childDetailConfiguration.Title = "Order Details"
childDetailConfiguration.SetValue( TableView.ShowFixedColumnSplitterProperty, false )
childDetailConfiguration.SetValue( TableView.DetailIndicatorWidthProperty, 50 )
detailConfiguration.DetailConfigurations.Add( childDetailConfiguration )
dataGridControl.DetailConfigurations.Add( detailConfiguration )
C#
Copy Code
dataGridControl.AutoCreateDetailConfigurations = true;
dataGridControl.Columns[ "Photo" ].Visible = false;
DetailConfiguration detailConfiguration = new DetailConfiguration();
detailConfiguration.RelationName = "Employee_Orders";
detailConfiguration.Title = "Employee Orders";
detailConfiguration.Columns[ "EmployeeID" ].Visible = false;
detailConfiguration.SetValue( TableView.DetailIndicatorWidthProperty, 50 );
detailConfiguration.SetValue( TableView.FixedColumnCountProperty, 2 );
DetailConfiguration childDetailConfiguration = new DetailConfiguration();
childDetailConfiguration.RelationName = "Order_OrderDetails";
childDetailConfiguration.Title = "Order Details";
childDetailConfiguration.SetValue( TableView.ShowFixedColumnSplitterProperty, false );
childDetailConfiguration.SetValue( TableView.DetailIndicatorWidthProperty, 50 );
detailConfiguration.DetailConfigurations.Add( childDetailConfiguration );
dataGridControl.DetailConfigurations.Add( detailConfiguration );