Xceed DataGrid for WPF v7.3 Documentation
Xceed.Wpf.DataGrid Assembly / Xceed.Wpf.DataGrid Namespace / EntityDetailDescription Class
Members Example


In This Topic
    EntityDetailDescription Class
    In This Topic
    The EntityDetailDescription class provides information about a EntityCollection<TEntity> detail relation and whose content will be displayed as the details of the master data items in a grid or as the data items of another detail.
    Syntax
    'Declaration
     
    <TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)>
    <NameScopePropertyAttribute("NameScope", System.Windows.NameScope)>
    Public Class EntityDetailDescription 
       Inherits DataGridDetailDescription
    'Usage
     
    Dim instance As EntityDetailDescription
    [TypeDescriptionProvider(MS.Internal.ComponentModel.DependencyObjectProvider)]
    [NameScopeProperty("NameScope", System.Windows.NameScope)]
    public class EntityDetailDescription : DataGridDetailDescription 
    Remarks

    By default the Entity Framework does not load references to related entity objects. In this situation, the QueryDetails event exposed by the EntityDetailDescription class can be handled to provide details for a data item. For example, in the code snippet above , a query that will return the appropriate details for a parent item is executed and the Handled property set to true to indicate that the event was handled. In the case where the event is not handled and columns contain references to external Entity objects, the column would have remained empty unless those objects had been cached when loaded by some other means.

    Because an Entity object does not have a default visual representation, its string representation will be displayed in the column. In order to change its appearance, a CellContentTemplate must be provided.

    Example
    Private Sub EntityDetailDescription_QueryDetails( sender As Object, e As QueryEntityDetailsEventArgs )
    
      Dim customer As Customer = TryCast( e.ParentItem, Customer )
    
      ' Since EntityFramework doesn't load automatically references to
      ' other objects, we build a query that will include those objects.
      ' We start from the base query but we could have added restrictions
      ' to the query.
      Dim query As ObjectQuery( Of Order ) = customer.Orders.CreateSourceQuery()
      customer.Orders.Attach( query.Include( "Employee" ).Include( "Shipper" ) )
    
      e.Handled = True
    End Sub
    private void EntityDetailDescription_QueryDetails( object sender, QueryEntityDetailsEventArgs e )
    {
      Customer customer = ( Customer )e.ParentItem;
    
      // Since EntityFramework doesn't load automatically references to
      // other objects, we build a query that will include those objects.
      // We start from the base query but we could have added restrictions
      // to the query.
      ObjectQuery<Order> query = customer.Orders.CreateSourceQuery();
      customer.Orders.Attach( query.Include( "Employee" ).Include( "Shipper" ) );
    
      e.Handled = true;
    }
    Inheritance Hierarchy

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.DependencyObject
             Xceed.Wpf.DataGrid.DataGridDetailDescription
                Xceed.Wpf.DataGrid.EntityDetailDescription

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also