You are viewing help content for pre-release software. This document and the features it describes are subject to change. Switch to the current version.

DetailDescriptorSelector Class

Enables you to select which detail descriptor to use in data dependent details.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.2.Core.dll

Declaration

public class DetailDescriptorSelector :
    MultiDetailDescriptorBase
Public Class DetailDescriptorSelector
    Inherits MultiDetailDescriptorBase

Remarks

The GridControl allows you to define a simple detail selection logic in XAML (using the DetailDescriptorSelector object) in the following way:

  1. Pass the DetailDescriptorSelector object to the GridControl.DetailDescriptor property.

    <dxg:GridControl ItemsSource="{x:Static local:ViewModel.Employees}">
        <dxg:GridControl.DetailDescriptor>
            <dxg:DetailDescriptorSelector>
                <!-- DetailDescriptorSelector -->
            </dxg:DetailDescriptorSelector>
        </dxg:GridControl.DetailDescriptor>
    </dxg:GridControl>
    
    NOTE

    The DetailDescriptorSelector can be bound only to a corresponding master row object's properties.

  2. The DetailDescriptorSelector selects a detail descriptor when a corresponding trigger condition is met.

    The code sample below demonstrates how to provide a detail descriptor that is selected for master rows that meet specific criteria (Employees.Count == 0 in this example).

    <dxg:GridControl ItemsSource="{x:Static local:ViewModel.Employees}">
        <dxg:GridControl.DetailDescriptor>
            <dxg:DetailDescriptorSelector>
                <!-- A detail descriptor selected for master rows, whose Employees.Count value is equal to 0 -->
                <dxg:DetailDescriptorTrigger Binding="{Binding Path=Employees.Count}" Value="0">
                    <dxg:DataControlDetailDescriptor ItemsSourcePath="Customers">
                        <dxg:GridControl>
                            <!-- The detail GridControl settings -->
                        </dxg:GridControl>
                    </dxg:DataControlDetailDescriptor>
                </dxg:DetailDescriptorTrigger>
            </dxg:DetailDescriptorSelector>
        </dxg:GridControl.DetailDescriptor>
        <!-- The master GridControl settings -->
    </dxg:GridControl>
    
  3. To provide a default detail descriptor, pass the DetailDescriptorSelector with the configured detail GridControl to the DetailDescriptorSelector.DefaultValue property.

    <dxg:GridControl ItemsSource="{x:Static local:ViewModel.Employees}">
        <dxg:GridControl.DetailDescriptor>
            <dxg:DetailDescriptorSelector>
    
                <!-- The default detail descriptor -->
                <dxg:DetailDescriptorSelector.DefaultValue>
                    <dxg:DataControlDetailDescriptor ItemsSourcePath="Employees">
                        <dxg:GridControl>
                            <!-- The default detail GridControl settings -->
                        </dxg:GridControl>
                    </dxg:DataControlDetailDescriptor>
                </dxg:DetailDescriptorSelector.DefaultValue>            
    
                <!-- A detail descriptor selected for master rows, whose Employees.Count value is equal to 0 -->
                <dxg:DetailDescriptorTrigger Binding="{Binding Path=Employees.Count}" Value="0">
                    <dxg:DataControlDetailDescriptor ItemsSourcePath="Customers">
                        <dxg:GridControl>
                            <!-- The detail GridControl settings -->
                        </dxg:GridControl>
                    </dxg:DataControlDetailDescriptor>
                </dxg:DetailDescriptorTrigger>
    
            </dxg:DetailDescriptorSelector>
        </dxg:GridControl.DetailDescriptor>
        <!-- The master GridControl settings -->
    </dxg:GridControl>
    
See Also