开发者

.NET - Is it possible to update a screen only at the end of a method?

I am changing position of some things inside the CompositionTarget.Rendering even开发者_JS百科t, 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();
}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜