title: ICollectionView Filter won't refresh - are my bindings wrong?
body: <p>I'm writing a program to view images, list them by their file name, and have a text box for searching that automatically filters the list as you type in it.</p>
  
  <p>I can see the filter actually working - and it looks as if the refresh is firing too - however it does not 'refresh' on the screen.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>public MainWindow()
  {
      InitializeComponent();
      DataContext = this;
      ICollectionView collectionView = CollectionViewSource.GetDefaultView(AllImages);
      new DynamicFiltering(collectionView, this.TextBoxFilter);
  }
  
  public class DynamicFiltering
  {
      public DynamicFiltering(ICollectionView filteredView, TextBox textBox)
      {
          string filterText = "";
          filteredView.Filter = delegate(object item)
          {
              MyImages textvalue = item as MyImages;
              string textvaluestring = textvalue.Name as string;
              if (textvaluestring.ToUpper().Contains(filterText.ToUpper()))
                  return true;
              else
                  return false;
          };
          textBox.TextChanged += delegate
          {
              filterText = textBox.Text;
              filteredView.Refresh();
          };
      }
  }
  </code></pre>
  
  <p>and the xaml is </p>
  
  <pre><code>&lt;TextBox x:Name="TextBoxFilter"/&gt;
  
  &lt;ListBox Name="VisualList"
           Template="{StaticResource StandardListBox}"
           DataContext="{Binding AllImages}"
           ItemsSource="{Binding}"
           Width="Auto"
           Grid.Row="1"/&gt;
  </code></pre>
  
  <p>Is the problem in the list box binding? Another thing perhaps noteable is i'm holding a string and imagesource within each object in my list.</p>
  
  <hr>
  
  <p>EDIT:
  Below is the code i use to populate AllImages - using Environment.SpecialFolder.MyPictures as a sample.</p>
  
  <pre><code>    public class MyImages
      {
          public ImageSource _image;
          public string _name;
  
          public MyImages(ImageSource image, string name)
          {
              _image = image;
              _name = name;
          }
  
          public override string ToString()
          {
              return _name;
          }
  
          public ImageSource Image
          {
              get { return _image; }
          }
  
          public string Name
          {
              get { return _name; }
          }
  
      }
  
      public List&lt;MyImages&gt; AllImages
      {
          get
          {
              List&lt;MyImages&gt; result = new List&lt;MyImages&gt;();
              foreach (string filename in
                  System.IO.Directory.GetFiles(
                  Environment.GetFolderPath(
                  Environment.SpecialFolder.MyPictures)))
              {
                  try
                  {
                      result.Add(
                      new MyImages(
                      new BitmapImage(
                      new Uri(filename)),
                      System.IO.Path.GetFileNameWithoutExtension(filename)));
                  }
                  catch { }
              }
              return result;
          }
      }
  </code></pre>