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 ObservableCollectioncvsSelectedAttributes is a CollectionViewSourceand 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!
Hi Petar,
I find it hard to believe and accept your response. One reason is that the row is actually being added to the XamGrid as I can visually see it in the grid. If you can sense the fact that I've added a row to the collection and consequently you add the row to the grid, what's so difficult about firing the 'RowAdded' event? (I am quiet familiar with the ObservableCollection's INotifyCollectionChanged interface and the CollectionChanged event). To me, if a row is added then the RowAdded event should fire, period.
Now, let's suppose I put some code in the CollectionChanged event handler, from this event how am I supposed to get a reference to the XamGrid Row that is being added? I need a reference to the XamGrid row added in order to scroll the row into view:
ScrollCellIntoView(e.Row.Cells[0])
I need help ASAP.
Thanks,
Joe
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.