0

I am changing position of some things inside the CompositionTarget.Rendering event, so it has a little delay. If I could update the layout only at the end of this event, I guess this problem would be solved. Is it possible? Thank you.


CompositionTarget.Rendering += new EventHandler(Draw);
void Draw(object sender, EventArgs e)
{
   ...
   //update();
}

alansiqueira27
  • 8,129
  • 15
  • 67
  • 111

1 Answers1

-1

What .net framework are you using. .net 4 introduced the cachemode property to uielememts. Setting this property to an instance of bitmapcache will rasterise your the element and it's children to a cache and does not re-rasterize until the tree is changed.

http://msdn.microsoft.com/en-us/library/system.windows.media.bitmapcache(v=VS.100).aspx

Consider also using bitmaprendertarget to active the same with a little more flexibility.

Gusdor
  • 14,001
  • 2
  • 52
  • 64
  • Are you absolutely sure this isn't just an unfortunate side effect of the deferred rendering wpf employs? I've found there is usually an indeterminate time between making changes and seeing the changes onscreen. – Gusdor Dec 17 '10 at 12:19