'Declaration Public Class QueryDistinctValueEventArgs Inherits System.EventArgs
'Usage Dim instance As QueryDistinctValueEventArgs
public class QueryDistinctValueEventArgs : System.EventArgs
'Declaration Public Class QueryDistinctValueEventArgs Inherits System.EventArgs
'Usage Dim instance As QueryDistinctValueEventArgs
public class QueryDistinctValueEventArgs : System.EventArgs
All examples in this topic assume that the grid is bound to the Orders table of the Northwind database, unless stated otherwise.
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> <Grid.Resources> <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" Source="{Binding Source={x:Static Application.Current}, Path=Orders}" AutoFilterMode="And" DefaultCalculateDistinctValues="False"> <xcdg:DataGridCollectionViewSource.ItemProperties> <xcdg:DataGridItemProperty Name="OrderDate" QueryDistinctValue="DataGridItemProperty_QueryDistinctValue_Date" CalculateDistinctValues="True"/> <xcdg:DataGridItemProperty Name="RequiredDate" QueryDistinctValue="DataGridItemProperty_QueryDistinctValue_Date" CalculateDistinctValues="True" /> <xcdg:DataGridItemProperty Name="ShippedDate" QueryDistinctValue="DataGridItemProperty_QueryDistinctValue_Date" CalculateDistinctValues="True" /> <xcdg:DataGridItemProperty Name="Freight" QueryDistinctValue="DataGridItemProperty_QueryDistinctValue_Range" CalculateDistinctValues="True" /> </xcdg:DataGridCollectionViewSource.ItemProperties> </xcdg:DataGridCollectionViewSource> </Grid.Resources> <xcdg:DataGridControl x:Name="OrdersGrid" ItemsSource="{Binding Source={StaticResource cvs_orders}}"/> </Grid>
Private Sub DataGridItemProperty_QueryDistinctValue_Date( ByVal sender As Object, ByVal e As QueryDistinctValueEventArgs ) If TypeOf e.DataSourceValue Is DateTime Then e.DistinctValue = CDate( e.DataSourceValue ).ToString( "MMMM" ) End If End Sub Private Sub DataGridItemProperty_QueryDistinctValue_Range( ByVal sender As Object, ByVal e As QueryDistinctValueEventArgs ) If TypeOf e.DataSourceValue Is Decimal Then Dim value As Decimal = CDec( e.DataSourceValue ) If value <= 100 Then e.DistinctValue = "0 - 100" ElseIf( value > 100 And value <= 500 ) Then e.DistinctValue = "101 - 500" Else e.DistinctValue = "500+" End If End If End Sub
private void DataGridItemProperty_QueryDistinctValue_Date( object sender, QueryDistinctValueEventArgs e ) { if( e.DataSourceValue is DateTime ) { e.DistinctValue = ( ( DateTime )e.DataSourceValue ).ToString( "MMMM" ); } } private void DataGridItemProperty_QueryDistinctValue_Range( object sender, QueryDistinctValueEventArgs e ) { if( e.DataSourceValue is decimal ) { decimal value = ( decimal )e.DataSourceValue; if( value <= 100 ) { e.DistinctValue = "0 - 100"; } else if( value > 100 && value <= 500 ) { e.DistinctValue = "101 - 500"; } else { e.DistinctValue = "500+"; } } }
System.Object
System.EventArgs
Xceed.Wpf.DataGrid.QueryDistinctValueEventArgs
| Name | Description | |
|---|---|---|
![]() | DataSourceValue | Gets the original distinct value extracted from the underlying data source. |
![]() | DistinctValue | Gets or sets the custom distinct value that replaces the one originally extracted from the underlying data source. |
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Framework: net20, net35, net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.