TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
eclipse eclipse
NA
3
1.1k
Datagrid - MultiValueConverter called twice on Refresh
Jul 5 2014 8:28 AM
Hello,
I'm using a Datagrid bound on a collection of custom objects, with 20 columns.
I also use a MultiValueConverter to change the background color of each cell based on some different rules.
When the user clicks on some buttons, these rules change and the Datagrid cells background color are changed.
My collection never changes
.
The problem is that when I call
MyDatagrid.Items.Refresh()
,
the background converter is called twice for all visible cells
.
It's the same behavior when I call
CollectionViewSource.GetDefaultView(MyDatagrid.ItemsSource).Refresh()
;
When I call
MyDatagrid.InvalidateVisual()
, or
UpdateLayout()
, the visible cells are not changed until I use the scroll bar.
Several grids need to be changed, and it takes about 190 ms for each grid to be refreshed. That's too much.
I need to invalidate visible cells only once for performance reasons.
How can I do that ?
My project : WPF, target : framework 4.0
Thanks in advance
Reply
Answers (
1
)
Data Binding
MVVM WPF Architecture