Xceed DataGrid for WPF v7.3 Documentation
Xceed.Wpf.DataGrid Assembly / Xceed.Wpf.DataGrid Namespace / DataGridCollectionViewBase Class / DistinctValuesConstraint Property
Example


In This Topic
    DistinctValuesConstraint Property (DataGridCollectionViewBase)
    In This Topic
    Gets or sets a value representing the constraint applied to the DistinctValues when automatically filtering data items.
    Syntax
    'Declaration
     
    Public Overridable Property DistinctValuesConstraint As DistinctValuesConstraint
    'Usage
     
    Dim instance As DataGridCollectionViewBase
    Dim value As DistinctValuesConstraint
     
    instance.DistinctValuesConstraint = value
     
    value = instance.DistinctValuesConstraint
    public virtual DistinctValuesConstraint DistinctValuesConstraint {get; set;}

    Property Value

    A DistinctValuesConstraint value representing the constraint applied to the DistinctValues when automatically filtering data items. By default, DistinctValuesConstraint.All.

    Member Description
    All No constraint is applied to the data items.
    Filtered

    Distinct values are constrained to the currently filtered list of values.

    FilteredWithAllFilters

    Distinct values are constrained to all filters currently applied to the grid (including filtering from a predicate and a FilterRow).

    Remarks
    Example
    All examples in this topic assume that the grid is bound to the Orders table of the Northwind database, unless stated otherwise.
    The following example demonstrates how to enable automatic filtering, disabling it for the columns that will not support it and filtering the distinct values of the ShipCity column.
    <Grid> 
      <Grid.Resources> 
      <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                         Source="{Binding Source={x:Static Application.Current}, 
                                                          Path=Orders}" 
                                         AutoFilterMode="And" 
                                         DistinctValuesConstraint="Filtered" 
                                         AutoCreateItemProperties="False">       
           <xcdg:DataGridCollectionViewSource.ItemProperties> 
             <xcdg:DataGridItemProperty Name="ShipCountry" 
                                              Title="Country"/> 
             <xcdg:DataGridItemProperty Name="ShipCity" 
                                       Title="City"/> 
            <xcdg:DataGridItemProperty Name="ShipAddress" 
                                       Title="Address"/> 
            <xcdg:DataGridItemProperty Name="ShipPostalCode" 
                                       Title="Postal Code"/> 
             <xcdg:DataGridItemProperty Name="ShipName" 
                                       Title="Name" 
                                       CalculateDistinctValues="False"/> 
             <xcdg:DataGridItemProperty Name="OrderDate" 
                                       Title="Order Date" 
                                       CalculateDistinctValues="False"/>                
             <xcdg:DataGridItemProperty Name="Freight" 
                                       CalculateDistinctValues="False"/> 
          </xcdg:DataGridCollectionViewSource.ItemProperties> 
        </xcdg:DataGridCollectionViewSource>        
      </Grid.Resources> 
      <xcdg:DataGridControl x:Name="OrdersGrid" 
                            ItemsSource="{Binding Source={StaticResource cvs_orders}}"/> 
    </Grid>
    Requirements

    See Also