Home Forums WPF controls Xceed DataGrid for WPF problems adding

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23336 |

    Hi,

    I’m having a few problems adding a new record.

    I have a custom collection that implements IBindingList. I have overridden AddNewCore() and set AllowNew=true.

    when I start to edit the first (maybe any?) cell in the insertion row I get this exception;

    “An attempt was made to add a new data item to a source that does not support insertion”

    What more do I need to do to allow insertion?

    many thanks

    Imported from legacy forums. Posted by Jack (had 4619 views)

    Xceed Support
    Member
    Post count: 5658

    Can you give us more context regarding your particular problem?

    XAML/C#/VB code used to initialize the DataGridControl/DataSource

    Imported from legacy forums. Posted by Marcus [Xceed] (had 248 views)

    User (Old forums)
    Member
    Post count: 23064

    sure

    MyCollection is a CSLA object that implements several interfaces, including; IBindingList, IList, ICollection, IEnumerable.

    OnLoad of my user control I run this code;

    DataGridCollectionView temp = new DataGridCollectionView(MyCollection);
    grid.ItemsSource = temp;

    OnLoad also executes;

    private void ResetGrid(bool showInsertionRow, bool showGroupByControl)
    private void AdjustHeadersFooters(bool showInsertionRow, bool showGroupByControl)

    from your DataBinding sample.

    I’ve put breakpoints in the AddNew, AddNewCore and the getter for AllowNew, but these breakpoints are not hit before the exception occurs.

    If you want fuller code samples, please let me know.

    Imported from legacy forums. Posted by Jack (had 335 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve also just started to try and capture these events;

    InitializingInsertionRow
    AddingNewDataItem

    but they don’t appear to fire at all, but I’ll keep looking into it in case I’ve made a mistake somewhere.

    thanks

    Imported from legacy forums. Posted by Jack (had 388 views)

    Xceed Support
    Member
    Post count: 5658

    Do you implement INotifyCollectionChanged in your collection? If this is the case, only this interface is taken and we ignore IBindingList—resulting in the problems you are experiencing. This issue has been noted although I cannot provide you with a timeframe as to when it will be corrected.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 328 views)

    User (Old forums)
    Member
    Post count: 23064

    No, they don’t.

    Here’s a long list, but this type of CSLA collection implements;

    ICloneable, IBindingList, IList, ICollection, IEnumerable, ICancelAddNew, IRaiseItemChangedEvents

    um… i just noticed that this particular collection implements INotifyPropertyChanged. By this time tomorrow I’ll have tried it with a collection that does not.

    thanks again.

    Imported from legacy forums. Posted by Jack (had 302 views)

    User (Old forums)
    Member
    Post count: 23064

    This was added in the following release, you can download the latest package <a href=”http://download3.xceedsoft.com/Packages/3.2.7559.11410/XceedComponents.exe”>here </a>

    Imported from legacy forums. Posted by Matt (had 5549 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.