[Root] / Xceed.Wpf.DataGrid Assembly / Xceed.Wpf.DataGrid Namespace / ColumnBase Class / AutoFilterControlStyle Property
Example


In This Topic
    AutoFilterControlStyle Property
    In This Topic
    Gets or sets the style that will be used by the column's associated AutoFilterControl.
    Syntax
    'Declaration
     
    Public Property AutoFilterControlStyle As Style
    'Usage
     
    Dim instance As ColumnBase
    Dim value As Style
     
    instance.AutoFilterControlStyle = value
     
    value = instance.AutoFilterControlStyle
    public Style AutoFilterControlStyle {get; set;}

    Property Value

    A Style representing the style that will be used by the column's associated AutoFilterControl.
    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 provide the ShipCountry column with a new style for its associated AutoFilterControl that will only allow single selection.
    <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>  
         <Style x:Key="autoFilterControlStyle" 
           TargetType="{x:Type xcdg:AutoFilterControl}"> 
           <Setter Property="Template"> 
             <Setter.Value> 
               <ControlTemplate> 
                 <ListBox x:Name="PART_DistinctValuesHost" 
                          SelectionMode="Single"/> 
               </ControlTemplate> 
             </Setter.Value> 
           </Setter> 
         </Style> 
      </Grid.Resources> 
     
      <xcdg:DataGridControl x:Name="OrdersGrid" 
                            ItemsSource="{Binding Source={StaticResource cvs_orders}}"> 
        <xcdg:DataGridControl.Columns> 
         <xcdg:Column FieldName="ShipCountry" 
                      AutoFilterControlStyle="{StaticResource autoFilterControlStyle}"/> 
        </xcdg:DataGridControl.Columns> 
      </xcdg:DataGridControl> 
    </Grid>
    Supported Frameworks

    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