Hi,
my grids datasourse is a list of objects (with serveral properties)
dim myList as new myList (of MyObject)
myList.add(myOb)
myList.add(myOb2)
UltraGrid1.DataSource = myList
Now, if one Property in an Object is changed, the grid changes too. Thats perfect. BUT in the "InitializeRow"-Event i set the Image of the Rowselector. This works only for the first time, when the datasource is set, not if only one property of an object is changed.
How can i set the RowSelector-Image? Which Event is fired, when my object has changed?
(The Problem is, at the Moment, the property changed, i don't have the effected row! (if yes, i know that i could fire the initializeRow Event again....)
Thanks so much and sorry for my bad english!
Hello BBK_JB,
Additionally, lists used for data binding must implement the IBindingList, which provides property change information to bound controls. This way the InitializeRow is fired automatically every time a change to a field in the data source has been made. To achieve this you can create a BindingList that contains a business object type that implements INotifyPropertyChanged as list does not support the proper notification.
In the sample project I created I use a BindingList as a data source. The Product class implements the INotifyPropertyChanged interface, which communicates to a bound control the property changes on the object.
In the InitializeRow event handler I set a different image to a grid’s row if any changes have been made to its data.
Please let me know if this answers your question and if you need any further assistance regarding this matter.
The Ultra Grid control displays default images in the Row Selectors to indicate certain states of a row like active row, state for adding new row, etc. You can replace these default images by using the RowSelectorImages property of the grids DisplayLayout object. Please find attached a sample windows forms project where I have demonstrated this in the grid’s InitializeLayout event handler.
If you need to be able to add and delete rows in the grid, then a List is not a good DataSource to use. It is recommended when you want the grid only to display the data in the list as it does not notify the grid when you add or remove rows. In my sample project I use a BindingList<T> instead, which will allow you to update the grid’s rows. You can find more information about this here: http://es.infragistics.com/help/winforms/wingrid-ilist-and-ibindinglist.
Let me know if you need any further assistance regarding this matter.