Xceed Toolkit Plus for WPF v4.6 Documentation
OrFilterExpression Class
Members  Example 


Xceed.Wpf.ListBox Assembly > Xceed.Wpf.Data Namespace : OrFilterExpression Class
Represents a logical OR filter expression, which states that an item must match one of the specified child filters in order to be included.
Syntax
'Declaration
 
<DebuggerDisplayAttribute("FilterBy = {DebuggerDisplayString}")>
<ContentPropertyAttribute("ChildExpressions")>
Public NotInheritable Class OrFilterExpression 
   Inherits FilterExpressionOperator
'Usage
 
Dim instance As OrFilterExpression
[DebuggerDisplay("FilterBy = {DebuggerDisplayString}")]
[ContentProperty("ChildExpressions")]
public sealed class OrFilterExpression : FilterExpressionOperator 
Remarks
Once the filter expression has been created, it is considered "frozen" and its values can no longer be modified.
Example
<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;
}
Inheritance Hierarchy

System.Object
   Xceed.Wpf.Data.FilterExpressionBase
      Xceed.Wpf.Data.FilterExpressionOperator
         Xceed.Wpf.Data.OrFilterExpression

Requirements

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

Reference

OrFilterExpression Members
Xceed.Wpf.Data Namespace
cf224116-45e2-4539-9fd6-71cc219add2e