Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
635
question about filtering and xamDataGrid with DataSet
posted

I followed the instructions here: http://help.infragistics.com/Help/NetAdvantage/WPF/2010.2/CLR4.0/html/xamDataPresenter_Binding_a_DataPresenter_Control_to_a_DataSet.html to bind my grid to a DataSet. But when I click on the drop down box on the filter it throws an InvalidOperationException.

Message: "Collection was modified; enumeration operation may not execute."

Source: PresentationFramework

StackTrace:    at System.Windows.Data.CollectionView.PlaceholderAwareEnumerator.MoveNext()

 

my code looks like:

private DataSet dsDummyData;

public void CreateDummyData(int NumRowsToCreate)
    {
      dsDummyData = new DataSet();
      dsDummyData.Tables.Add("testData");
      dsDummyData.Tables["testData"].Columns.Add("Price");
      var list = new List<object[]>();
      for (double i = NumRowsToCreate; i > 0; i--)
      {
        var priceData = new object[1];
        priceData[0] = i;
        list.Add(priceData);
      }
      foreach (var objectse in list)
      {
        dsDummyData.Tables["testData"].Rows.Add(objectse);
      }
    }


    private void UserControl_Loaded(object sender, RoutedEventArgs e)
    {
      CreateDummyData(10);
      if (dsDummyData.Tables["testData"] != null)
      {
        this.myGrid.DataSource = dsDummyData.Tables["testData"].DefaultView;
      }
    }

 

What am I missing?

 

 

Parents
No Data
Reply
  • 105
    posted

    Normal 0 false false false EN-GB X-NONE X-NONE MicrosoftInternetExplorer4

    Hi,

    I have recently upgraded to 11.1 infragistics from 2010.  I am used to having exception free code and therefore I catch all thrown exceptions when debugging.

    After upgrading to 2011 from 2010 I am seeing lots of  exceptions which did not use to be there. They appear randomly as I activate rows, row filter or try editing cells in xamDataGrid.

    All exceptions are handled I just want to point out the different behaviour in your code which used to be exception free on WPF 2010.3.

     

    System.InvalidOperationException occurred

      Message=Collection was modified; enumeration operation may not execute.

      Source=PresentationFramework

      StackTrace:

           at System.Windows.Data.CollectionView.PlaceholderAwareEnumerator.MoveNext()

     

    last callstack from infragistics library before calling  PresentationFramework.dll

    PresentationFramework.dll!System.Windows.Data.CollectionView.OnCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs args) Line 1126 + 0xc bytes   C#

                    InfragisticsWPF4.v11.1.dll!Infragistics.Collections.ObservableCollectionExtended<Infragistics.Windows.DataPresenter.FilterDropDownItem>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + 0x12 bytes

                    InfragisticsWPF4.v11.1.dll!Infragistics.Collections.ObservableCollectionExtended<Infragistics.Windows.DataPresenter.FilterDropDownItem>.EndUpdate() + 0x92 bytes      

                    InfragisticsWPF4.DataPresenter.v11.1.dll!Infragistics.Windows.DataPresenter.ResolvedRecordFilterCollection.FilterDropDownItemLoader.PopulatePhase1() + 0x13a bytes   

Children
No Data