Xceed.Silverlight.DataGrid.v2.0 Assembly > Xceed.Silverlight.DataGrid Namespace > FilterRow Class : FilterExpression Property |
'Declaration Public Property FilterExpression As FilterExpressionBase
'Usage Dim instance As FilterRow Dim value As FilterExpressionBase instance.FilterExpression = value value = instance.FilterExpression
public FilterExpressionBase FilterExpression {get; set;}
Values entered into the filter row are neither case sensitive nor time sensitive. If a case- or time- sensitive value is provided via a filter expression, an exception will be thrown. In other words, when creating a filter expression that is to be assigned to a filter row programmatically, its IsCaseSenstive and IsTimeSensitive properties must both be set to false.
If a string value is specified, the IsCaseSenstive property must be set to true or false; otherwise, an exception will be thrown.
<sldg:DataGridControl x:Name="sldgDataGridControl" ItemsSource="{Binding Path=Orders}"> <sldg:DataGridControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <sldg:SignatureThemeResourceDictionary /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </sldg:DataGridControl.Resources> <sldg:DataGridControl.FixedHeaders> <CheckBox Content="Display only French-Speaking Countries" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Style="{StaticResource SignatureThemeCheckBoxStyle}"/> <sldg:FilterRow> <sldg:FilterRow.FilterExpression> <sldg:AndFilterExpression> <sldg:FilterExpression MemberName="ShipVia" Value="3" FilterOperator="Equal" /> <sldg:FilterExpression MemberName="OrderDate" Value="2008/01/01" FilterOperator="GreaterThanOrEqual" IsTimeSensitive="False"/> </sldg:AndFilterExpression> </sldg:FilterRow.FilterExpression> </sldg:FilterRow> </sldg:DataGridControl.FixedHeaders> </sldg:DataGridControl>
Private m_frenchCountries As New List( Of String)( New String( 27 ) { "Belgium", "Benin", "Burkina-Faso", "Burundi", "Cameroon", "Canada", "Central African Republic", "Chad", "Comoros", "Congo", "Djibouti", "France", "Gabon", "Guinea", "Haiti", "Ivory Coast", "Luxembourg", "Madagascar", "Mali", "Monaco", "Niger", "Rwanda", "Senegal", "Seychelles", "Switzerland", "Togo", "Vanuatu" } ) Private Function CreateFilterExpression() As OrFilterExpression Dim childExpressions As New List( Of FilterExpressionBase )() Dim country As String For Each country In m_frenchCountries Dim expression As New FilterExpression( "ShipCountry", FilterOperator.Equal, country, False ) childExpressions.Add( expression ) Next country Return New OrFilterExpression( childExpressions ) End Function Private m_filterExpression As OrFilterExpression = Nothing Private Sub CheckBox_Checked( ByVal sender As Object, ByVal e As RoutedEventArgs ) If m_filterExpression Is Nothing Then m_filterExpression = Me.CreateFilterExpression() End If Me.sldgDataGridControl.FilterExpression = m_filterExpression End Sub Private Sub CheckBox_Unchecked( ByVal sender As Object, ByVal e A RoutedEventArgs ) Me.sldgDataGridControl.FilterExpression = Nothing End Sub
private List<string> m_frenchCountries = new List<string>( new string[ 27 ] { "Belgium", "Benin", "Burkina-Faso", "Burundi", "Cameroon", "Canada", "Central African Republic", "Chad", "Comoros", "Congo", "Djibouti", "France", "Gabon", "Guinea", "Haiti", "Ivory Coast", "Luxembourg", "Madagascar", "Mali", "Monaco", "Niger", "Rwanda", "Senegal", "Seychelles", "Switzerland", "Togo", "Vanuatu" } ); private OrFilterExpression CreateFilterExpression() { List<FilterExpressionBase> childExpressions = new List<FilterExpressionBase>(); foreach( string country in m_frenchCountries ) { FilterExpression expression = new FilterExpression( "ShipCountry", FilterOperator.Equal, country, false ); childExpressions.Add( expression ); } return new OrFilterExpression( childExpressions ); } private OrFilterExpression m_filterExpression = null; private void CheckBox_Checked( object sender, RoutedEventArgs e ) { if( m_filterExpression == null ) m_filterExpression = this.CreateFilterExpression(); this.sldgDataGridControl.FilterExpression = m_filterExpression; } private void CheckBox_Unchecked( object sender, RoutedEventArgs e ) { this.sldgDataGridControl.FilterExpression = null; }
Target Platforms: Windows 7, Windows Vista, Windows XP SP3, Windows Server 2008 family