Possible to InvalidateVisual() on a given region instead of entire WPF control?
Posted
by Scott Bilas
on Stack Overflow
See other posts from Stack Overflow
or by Scott Bilas
Published on 2010-04-05T02:03:05Z
Indexed on
2010/04/05
2:13 UTC
Read the original article
Hit count: 272
I have a complex WPF control that draws a lot of primitives in its OnRender (it's sort of like a map). When a small portion of it changes, I'd only like to re-issue render commands for the affected elements, instead of running the entire OnRender over. While I'm fine with my OnRender function's performance on a resize or whatever, it's not fast enough for mouse hover-based highlighting of primitives.
Currently the only way I know how to force a screen update is to call InvalidateVisual(). No way to send in a dirty rect region to invalidate.
Is the lowest granularity of WPF screen composition the UI element? Will I need to do my renders of primitives into an intermediate target and then have that use InvalidateVisual() to update to the screen?
© Stack Overflow or respective owner