Imports System.Net
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports System.Windows.Data

Namespace CollectionViewFilter
	Partial Public Class MainPage
		Inherits UserControl
		Private _filter As ViewFilter

		Public Sub New()
			InitializeComponent()

			' create regular view, attach ViewFilter
			Dim view = New PagedCollectionView(Customer.GetCustomerList(200))
			_filter = New ViewFilter(view)

			' show the data
			_flex.ItemsSource = view
		End Sub

		' apply filter on button click or enter key
		Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
			_filter.FilterExpression = _txtFilter.Text
		End Sub
		Private Sub _txtFilter_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
			If e.Key = Key.Enter Then
				_filter.FilterExpression = _txtFilter.Text
			End If
		End Sub
	End Class
End Namespace
