Hi,
Please see my screenshot.
The second column contains a Project Type.
Is it possible using CellControlAttached to set a style (a line) when the project type changes to another type . (eg in my screenshot from Enhancements to Less is More).
Regards,
Nicolas
I forgot to tell that the line should be applied to all cells in that row.
You can set the Bottom BorderThickness or Top BorderThickness of the CellControl to 1 (depending on whether you modify the last value, or first value, and use the CellStyle property off of the row, to apply it to the entire row.
Using CellControlAttached, it should be possible, however, you'll have to walk your data, to compare to rows around it. If your data can't be sorted or filtered in the grid, i'd' recommend using your ItemSource directly as opposed to walking the grid's rows collection, as it should be quicker.
Hope this helps,
-SteveZ
Can you give a bit more info (or some dummy code) on "using your ItemsSource" directly to apply a style to a row when a certain condition is met ? (without using CellControlAttached) ?
Sorry if i was confusing.
I didn't suggest that there was another way to do this. You should use CellControlAttached.
And when i said "your ItemSource", i was simply suggesting you walk the collection you bound to the grid, as opposed to walking the rows.
Here is some pseudocode
ObservableCollection<yourData> _collection = getData():
this._xamWebGrid1.ItemSource = _collection;//In the CellControlAttached event. yourData data = (yourData)e.Cell.Row.Data;
int index = this. _collection.IndexOf(data):
int prevData = null, nextData = null;
if(index > 0)
prevData = this._collection[index -1]
if(index < this._collection.Count)
nextData = this._collection[index +1];
// Add code to check values.
// If True
((Row)e.Cell.Row).CellStyle = styleWithUnderline
else
((Row)e.Cell.Row).CellStyle = styleWithoutUnderline