[NullableContext(2)]
[Nullable(0)]
public class QueryDistinctValueEventArgs : System.EventArgs
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 custom distinct values that will display the only the month in columns that display DateTime values and that will filter according to a value range for a decimal column.
PrivateSub DataGridItemProperty_QueryDistinctValue_Date( ByVal sender AsObject, ByVal e As QueryDistinctValueEventArgs )
IfTypeOf e.DataSourceValue Is DateTime Then
e.DistinctValue = CDate( e.DataSourceValue ).ToString( "MMMM" )
EndIfEnd SubPrivateSub DataGridItemProperty_QueryDistinctValue_Range( ByVal sender AsObject, ByVal e As QueryDistinctValueEventArgs )
IfTypeOf e.DataSourceValue IsDecimalThenDim value AsDecimal = 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+"EndIfEndIfEnd Sub
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