Xceed Toolkit Plus for WPF v4.6 Documentation
SelectionRange Constructor(IEnumerable<SortDescription>,FilterExpressionBase,Predicate<Object>)
Example 


Xceed.Wpf.ListBox Assembly > Xceed.Wpf.ListBox Namespace > SelectionRange Class > SelectionRange Constructor : SelectionRange Constructor(IEnumerable<SortDescription>,FilterExpressionBase,Predicate<Object>)

One or more SortDescription objects, which will be used to create the data query that is sent to the data source. Must be provided at construction time.

The FilterExpressionBase to be used to filter the items server-side. Can be a null reference (Nothing in Visual Basic).
The filter predicated to be used to filter the items locally (see Remarks section). Can be a null reference (Nothing in Visual Basic).
Initializes a new instance of the SelectionRange class specifying sorting and filtering criteria. This constructor is to be used when a start and/or end needs to be specified for the SelectionRange (see StartRangeInfos and EndRangeInfos properties).
Syntax
'Declaration
 
Public Function New( _

   ByVal sortDescriptons As IEnumerable(Of SortDescription), _

   ByVal filterExpression As FilterExpressionBase, _

   ByVal filter As Predicate(Of Object) _

)
'Usage
 
Dim sortDescriptons As IEnumerable(Of SortDescription)

Dim filterExpression As FilterExpressionBase

Dim filter As Predicate(Of Object)

 

Dim instance As New SelectionRange(sortDescriptons, filterExpression, filter)

Parameters

sortDescriptons

One or more SortDescription objects, which will be used to create the data query that is sent to the data source. Must be provided at construction time.

filterExpression
The FilterExpressionBase to be used to filter the items server-side. Can be a null reference (Nothing in Visual Basic).
filter
The filter predicated to be used to filter the items locally (see Remarks section). Can be a null reference (Nothing in Visual Basic).
Exceptions
ExceptionDescription
One or more SortDescriptions must be specified.
Remarks

Predicates (i.e., filter parameters of various SelectionRange constructors) are executed locally, meaning that when the BeginGetSelectedItems and EndGetSelectedItems are called and a selection range that provides a predicate is used, items will be retrieved from the server in order to determine those that pass the filter.

If one or more start and end range information is provided and/or a filter expression, only the items that are not already excluded by the range information and filter expression will be retrieved.

In a virtualized environment, it is not recommended to use the filter predicate unless dealing with a very limited number of items.

Example
Additional examples that demonstrate how to select data programmatically can be found in the Selecting Data topic.
Dim range As New SelectionRange( New SortDescription() { New SortDescription( "ShipCountry", ListSortDirection.Ascending ) }, Nothing, Nothing)

 

range.StartRangeInfos.Add( "ShipCountry", "Germany" )

range.EndRangeInfos.Add( "ShipCountry", "Germany" )

 

Me.sllbListBox.SelectedRanges.Clear()

Me.sllbListBox.SelectedRanges.Add( range )
SelectionRange range = new SelectionRange( new SortDescription[] { new SortDescription( "ShipCountry", ListSortDirection.Ascending ) }, null, null );

 

range.StartRangeInfos.Add( "ShipCountry", "Germany" );

range.EndRangeInfos.Add( "ShipCountry", "Germany" );

 

this.sllbListBox.SelectedRanges.Clear();

this.sllbListBox.SelectedRanges.Add( range );
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

SelectionRange Class
SelectionRange Members
Overload List