WPF: Filtering a dataGrid on the fly
问题 In my WPF Window I have a DataGrid control, with its ItemsSource bound to an ObservableCollection of items (let's say a simple object with a couple properties): XAML: (Removed some xmlns stuff for brevity) <Window> <Window.Resources> <CollectionViewSource x:Key="MyViewSource" Source="{Binding MyItemList}" Filter="MyItemList_Filter"/> </Window.Resources> <Window.DataContext> <!-- Some Ioc stuff --> </Window.DataContext> <StackPanel> <TextBox Text="{Binding TextFilter}" /> <DataGrid Grid.Row="1