How can I highlight a row or column of a grid when it is changed in value compared to a previous itemsource?Should I use CellControlAttached? If so, you have an example in vb?Thanks
Alex
Hi Alex,
You can use our ConditionalFormatting feature, or you can use the CellControlAttached event:
http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=xamGrid_Conditional_Formatting.html
As for the event.
I don't have a sample in VB, however, you simply just need to use the Cell from the EventArgs and validate against it:
something like:
if(e.Cell.Column.Key == "YourColKey"){ YourDataObj data = (YourDataObj)e.Cell.Row.Data; if(data.YourColKey == 4) { e.Cell.Style = yourRedStyle }}basically all the code above is doing, is validating your on the column you want to check, Grabbing the data from the row, and casting it into your objectThen checking to see if the value is equal to 4, if so, then it sets the cell's style to a predefined style
-SteveZ
Hi SteveZ, thanks for your answer, but my question is this: if I have a grid with data and then I refresh the itemsource, I can have highlighted the data that has changed since the last collection? Maybe if you have an example in Vb or in C#...
Thank you
Hi,
Both approaches should work.
Your data just need to make sure it implements INotifyPropertyChanged, and the collection you set the ItemsSource of the xamGrid to, should be an ObservableCollection or a collection that implements INotifyCollectionChanged.
Both approaches listen for data changing. In the case of the event, its raised whenever a cell comes into view, and for cells that are already in view, it will be raised when its value changes(assuming you implemented INotifyPropertyChanged)
Hello SteveZ, my ItemsSource is an List (of Cls)
Public Class clsAltriDati
End C
lass
list.Add(
New clsAltriDati With _
{.Descrizione =
"Pag" & c.idpag,
.Scontrini = 0,
.Valore = c.VALORE,
.Media = 0})
Next
Did you can give me a litle sample, please ?
So I can understand where I mistake.
You should be using an ObservableCollect<> instead of a List<> as an OC implements INotifyCollectionChanged, so that the grid knows when items are added or removed and updates appropriately.
And also, your class doesn't implemenent INotifyPropertyChagned, which it needs to do. Then in the setter of each property, it should be raising the PropertyChanged event, when the value changes.