title: How to call Items.Refresh()?
body: <p>I am making a filter for a collection.<br />
  I know how to do it using CollectionViewSource.<br />
  But I wanted to do it without using CVS.<br />
  According to my ideas, there is a CollectionView in the ItemsControl.Items property and you can use the methods of this property.<br />
  The filter can be added without problems.<br />
  But after calling Items.Refresh() nothing changes.</p>
  <p>Simple example:</p>
  <pre class="lang-xml prettyprint-override"><code>    &lt;UniformGrid Columns=&quot;2&quot;&gt;
          &lt;FrameworkElement.Resources&gt;
              &lt;sc:StringCollection
                  x:Key=&quot;coll&quot;&gt;
                  &lt;sys:String&gt;112&lt;/sys:String&gt;
                  &lt;sys:String&gt;22&lt;/sys:String&gt;
                  &lt;sys:String&gt;33&lt;/sys:String&gt;
                  &lt;sys:String&gt;114&lt;/sys:String&gt;
                  &lt;sys:String&gt;411&lt;/sys:String&gt;
              &lt;/sc:StringCollection&gt;
              &lt;CollectionViewSource
                  x:Key=&quot;cvs&quot;
                  Source=&quot;{Binding Mode=OneWay, Source={StaticResource coll}}&quot;
                  Filter=&quot;OnFilterCV&quot;/&gt;
          &lt;/FrameworkElement.Resources&gt;
          &lt;TextBox x:Name=&quot;tBox&quot;
                   Text=&quot;1&quot;
                   TextChanged=&quot;OnTextChanged&quot;
                   VerticalAlignment=&quot;Center&quot;/&gt;
          &lt;TextBox x:Name=&quot;tBoxCV&quot;
                   Text=&quot;1&quot;
                   TextChanged=&quot;OnTextChangedCV&quot;
                   VerticalAlignment=&quot;Center&quot;/&gt;
          &lt;ItemsControl x:Name=&quot;iCtrl&quot;
                        ItemsSource=&quot;{Binding Mode=OneWay, Source={StaticResource coll}}&quot;&gt;
          &lt;/ItemsControl&gt;
          &lt;ItemsControl x:Name=&quot;iCtrlCV&quot;
                        ItemsSource=&quot;{Binding Mode=OneWay, Source={StaticResource cvs}}&quot;&gt;
          &lt;/ItemsControl&gt;
      &lt;/UniformGrid&gt;
  </code></pre>
  <pre class="lang-cs prettyprint-override"><code>    public partial class MainWindow : Window
      {
          private readonly CollectionViewSource cvs;
          public MainWindow()
          {
              InitializeComponent();
              iCtrl.Items.Filter = OnFilter;
              cvs = (CollectionViewSource)iCtrlCV.FindResource(&quot;cvs&quot;);
          }
  
          private bool OnFilter(object obj)
          {
              if (string.IsNullOrWhiteSpace(tBox.Text))
                  return true;
              string item = (string)obj;
              return item.Contains(tBox.Text, StringComparison.OrdinalIgnoreCase);
          }
  
          private void OnTextChanged(object sender, TextChangedEventArgs e)
          {
              Debug.WriteLine($&quot;OnTextChanged:\&quot;{tBox.Text}\&quot;&quot;);
              iCtrl?.Items.Refresh();
          }
  
          private void OnFilterCV(object sender, FilterEventArgs e)
          {
              e.Accepted = string.IsNullOrWhiteSpace(tBoxCV.Text) ||
                  ((string)e.Item).Contains(tBoxCV.Text, StringComparison.OrdinalIgnoreCase);
          }
  
          private void OnTextChangedCV(object sender, TextChangedEventArgs e)
          {
              Debug.WriteLine($&quot;OnTextChangedCV:\&quot;{tBoxCV.Text}\&quot;&quot;);
              cvs?.View.Refresh();
          }
      }
  </code></pre>
  <p>Am I misunderstanding something or doing something wrong?</p>
  <p><strong>Updated.</strong>
  Solution based on comment from @BionicCode.</p>
  <pre class="lang-cs prettyprint-override"><code>        private void OnTextChanged(object sender, TextChangedEventArgs e)
          {
              Debug.WriteLine($&quot;OnTextChanged:\&quot;{tBox.Text}\&quot;&quot;);
              //iCtrl?.Items.Refresh();
              if (iCtrl != null)
                  iCtrl.Items.Filter = new Predicate&lt;object&gt;(OnFilter);
          }
  
  </code></pre>