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
1540
RowAdded event not firing
posted

I know this because I put a breakpoint on the event handler and its not breaking as I add items to the collection.

Here's where I'm setting the event handler (in the USERCONTROL's Loaded handler:

this

 

.selectedAttributes.RowAdded += new EventHandler<Infragistics.Controls.Grids.RowEventArgs>(selectedAttributes_RowAdded);

Here's where I'm connecting the ObservableCollection to the XamGrid:

cvsSelectedAttributes.Source = vm.SelectedAttributes;
selectedAttributes.ItemsSource = cvsSelectedAttributes.View;

In case its not obvious:
vm.SelectedAttributes is an ObservableCollection
cvsSelectedAttributes is a CollectionViewSource
and selectedAttributes is a XamGrid

I've already tried removing the CollectionViewSource and connecting the ObservableCollection directly to the grid, like so:

selectedAttributes.ItemsSource = vm.SelectedAttributes;

It didn't help.

Here's the event handler:

 

 

 

 

void selectedAttributes_RowAdded(object sender,
Infragistics.Controls.Grids.
RowEventArgs e)
{
   
SelectedAttributes dataGrid = (SelectedAttributes)sender;

 

 

    if (dataGrid != null)
    {
        dataGrid.ScrollCellIntoView(e.Row.Cells[0]);
    }
}

The items are appearing as new rows in the XamGrid.  Why on earth is this event not being fired?  Am I missing a property setting or something else?

Pleas help ASAP!

Parents
  • 27093
    posted

    Hi,

     

    I have been looking into your enquiry and this is the designed behavior as the RowAdded event is not meant for detecting, whether items are added to your underlying collections. The event is meant to go off when you add a new row through the XamGrid’s UI: http://samples.infragistics.com/sllob/RunSamples.aspx?cn=grid#/grid/add-new-row . This is because, only in our designed environment we can provide consistent behavior, unlike all the types of collections arrays and tables that can provided as ItemsSource. In order to register the changes to your collection you can use its built-in functionality e.g. for the ObservableCollection, since it implements INotifyCollectionChanged, you can register for its CollecitonsChanged event.

     

    Please let me know if you require any further clarification on the matter.

Reply Children