This is a migrated thread and some comments may be shown as answers.

Force Redraw

1 Answer 1363 Views
GridView
This is a migrated thread and some comments may be shown as answers.
marc
Top achievements
Rank 1
marc asked on 20 Dec 2011, 11:11 AM
My customer requires grid cells to be joined vertically. This information must be updated whenever the grid changes, e.g. sorting/filtering updates of the underlying data. I now have the problem, that my grid contains the correct information but it is not redrawn with the updated information. the cell joining information is not on the objects contained in the list, but in a dictionary in the background. I am calling the method to update my dictionary when the grid is sorted. The grid is redrawn sorted correctly, but my information in the background is not up to date, so the cell-joining does not work correctly. I've tried various ways to have the grid update (also within the sorted event) but no success.

I've tried:
grid.InvalidateVisual();
grid.Measure(new Size());
grid.Visibility = Hidden -> Visible;

I've also tried the same on the parent element (a normal grid).

The thing is, when i hide the area where the problem is, then resize to show it, it's how it should be. so the data is up to date, but i can't seem to force a redraw at the right time.

I somehow need to force a redraw after the data has been updated and the sorting is done. any help much appreciated.

--- update

I have managed to get an update working, not so nice though. i am using DispatcherTimer to redraw after 10milliseconds. there is a visual jump though. but it does show that the underlying data is correct. I've also just noticed that my grid joining does not work, when items are removed/added to the list. what event on the radgridview can i use to find changes to the list (or even better the changes to the items in the list). I noticed LayoutUpdated does the trick, but it's mighty slow/called way too often.

1 Answer, 1 is accepted

Sort by
0
marc
Top achievements
Rank 1
answered on 03 Jan 2012, 12:51 PM
managed to solve the issue by rethinking the issue. the object holding the drawing information was converted to an observable object, this solved the issue.
Tags
GridView
Asked by
marc
Top achievements
Rank 1
Answers by
marc
Top achievements
Rank 1
Share this question
or