Can someone refer me to documentation about how the ItemsSource property is treated for a WPF XamGrid?
The only stuff I found said that it is of type IEnumerable and that it has specialized support for ObservableCollections and IList.
However, while binding a VM property of type DataView to the XamGrid, I find that it understands ADO.Net DataViews a *lot* better than the documentation allows. For example, it is aware of changes in the underlying data, presumably because of DataView events (or IBindingList ones). I'm wondering how far I should rely on this specialized behavior in the XamGrid that extends support for DataView beyond what IList seems to allow.
Please refer me to something that says that XamGrid's have support for IBindingList or DataView or such. I've put a watch on ItemsSource and the outer XamGrid and there are properties buried pretty deep (RowsManger and DataManager) that seem to indicate that the XamGrid really understands DataViews. Hopefully this is documented and reliable.
Hi dbeavon,
The DataView class implements IEnumerable so I would expect that the XamGrid could bind to it. Also the DataRowView class implements the necessary interfaces that would allow the XamGrid to find column "properties" on the row. It even implements INotifyPropertyChanged, so I don't think it's a stretch to think that the XamGrid would support it. There is no statement in the documentation that will specifically say it's supported though, at least that I could find. I also couldn't find where it mentioned specialized support for ObservableCollections and IList. I'm not sure what specialized support there could be for IList.
Either way, the XamGrid expects an IEnumerable and DataView is an IEnumerable. DataView and DataRowView both implement the necessary binding notifications that would be expected of a XAML component so the XamGrid can react to it.
http://help.infragistics.com/Help/Doc/WPF/2012.1/CLR4.0/html/xamGrid_Data_Binding.html
The above link has the only hinting I've found about the XamGrid being able to do *more* than you would expect from an IEnumerable. See the part titled "Data Binding Performance". It almost seems like the details are deliberately undocumented so you have tremendous wiggle room. Obviously an IEnumerable doesn't do a heck of a lot by itself.
I understand about DataRowView and its implementation of INotifyPropertyChanged. That isn't the main point of my question.
I am really a lot more interested and surprised by the fact that the XamGrid automatically keeps track of items being added or removed from the collection of rows in the DataView. It appears that it must have direct support for the DataView class and/or IBindingList. (The link above makes references to INotifyCollectionChanged which is part of ObservableCollection's implementation but this would not apply to DataView.)
So what can you tell me to help me explain all the additional functionality we see when binding to a DataView? It is one thing for the software to automagically do something "good", but it also needs to be documented and reliable or we'll have no recourse when it starts choosing to do something "bad" (or simply stops doing the "good" thing you relied on it to do).
NotifyCollectionChanged
You said "DataView ... implements the necessary binding notifications". In short this statement demonstrates the same confusion I have with ItemsSource.
IE. your documentation doesn't even allow for *any* collection-related binding notifications whatsoever in the case of DataView, given that it only mentions IEnumerable, IList and ObservableCollections.
I checked the source code for XamGrid and there are a few spots where we specifically check if the ItemsSource is a DataView so there is definitely some functionality specifically implemented for DataView. That said, our stance is that the XamGrid supports DataTable binding through DataView, so if you find that something isn't working the way you expect it to then it should be brought up with us so we can investigate and resolve it. I have sent our team responsible for the XamGrid an email to let them know that more specifics regarding the types of objects the XamGrid can be bound to has been requested for the documentation.
Thank you. this is the kind of statement I was looking for. I'll assume that the basic collection binding notifications from the DataView (in the VM) to the XamGrid (in the view) will work more or less as they would if you had a formal statement of support for the IBindingList interface.
Thanks, David
Just want to give you an update regarding the email to the dev team. They asked that I log a development issue for this so we should see more details as to what exactly the XamGrid can bind to in a future version of the documentation.