WPF Filter

Terrible trouble. Predicate confusion. Following works

Method 1 : Entity Framework

See http://wp.me/p17IS4-mX

Method 2

CType(BookViewSource.View, BindingListCollectionView).CustomFilter = String.Concat(“Title LIKE ‘%”, FilterTextBox.Text, “%'”)

Method 3

Dim view As New System.Data.DataView(Me.dsBook1.Books)
view.RowFilter = String.Format(“Title LIKE ‘%{0}%'”, FilterTextBox.Text)
MainGrid.DataContext = view

then possibly with Try-Catch

Private Sub ClearFilter()
MainGrid.DataContext = BookViewSource
CType(BookViewSource.View, BindingListCollectionView).CustomFilter = Nothing
End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: