title: c# using advanced datagridview (ADGV) filter without BindingSource
body: <p>I am using the advanced DataGridView (ADGV) found <a href="https://archive.codeplex.com/?p=adgv" rel="nofollow noreferrer">here</a> to add filtering capabilities to my application.</p>
  
  <p>The code for filtering or sorting is mentioned as:</p>
  
  <pre><code>private void advancedDataGridView1_SortStringChanged(object sender, EventArgs e)
  {
      this.stockHistoryBindingSource.Sort = advancedDataGridView1.SortString;
  }
  
  private void advancedDataGridView1_FilterStringChanged(object sender, EventArgs e)
  {
      this.stockHistoryBindingSource.Filter = advancedDataGridView1.FilterString;
  }
  </code></pre>
  
  <p>But I can't use this because in my project I am reading an XML file and binding it to my ADGV with this code:</p>
  
  <pre><code>void QueryFoos()
  {
      IEnumerable&lt;FooViewData&gt; query =
          from foo in XmlFiles.FOO.Root.Descendants("foo")
          select new FooViewData
          {
              ID = Convert.ToInt32(foo.Attribute("id").Value),
              Num = Convert.ToInt32(foo.Attribute("num").Value),
              ...
          };
  
      advancedDataGridView1.DataSource = query.OrderBy(n =&gt; n.ID).ThenBy(r =&gt; r.Num).ToList();
  }
  </code></pre>
  
  <p>I tried a code like this but I am not surprised that it is throwing exception in my face:</p>
  
  <pre><code>BindingSource x = (BindingSource)this.advancedDataGridView1.DataSource;
  x.Filter = advancedDataGridView1.FilterString;
  this.advancedDataGridView1.DataSource = x;
  </code></pre>
  
  <p>Is there some work around to use the filtering and sorting of the ADGV ?</p>