.net - WPF - LayoutUpdated event firing repeatedly -


I'm adding some animation to my WPF application.

Thanks, it proved to be quite simple to see one of my controls and its children had to move forward with some nice animation.

Unfortunately, it all comes with a performance overhead when the item is added / removed or the size of the control changes, then I think the performance is being affected, but it seems That this perf hit is completely even in the lifetime of the whole app, whenever the item is completely stable.

PanelLayoutAnimator class uses an associated asset to hook up the event. When this incident sets a fire, the render conversion is animated so that the children move to their new position.

Unfortunately it seems that the layout has been updated event every other or the fire, even when nothing is happening in the application (at least I do not think That my code is doing anything - the app has no focus and the mouse is stable.) Due to the cause of the incident the event controller is not immediately clear, all the children control has to be re-evaluated. About this incident once gets useless once. The frequency increases when the app is actually used.

So my question is, how can I improve performance here? Any answer will be appreciated, but I am currently stuck on these sub-questions:

  1. What is the layout updated event Does fire have to be done so many times? Is it supposed to be, and if not, how can I know why it fires and cuts?

  2. Is there a more convenient way within the handler, to know if anything can happen that the children have gone? If yes, then I can give bail quickly and can save every child from the upper part of looping.

  3. / Div>

    If you are updating the URL from EventHandler, if you are attached to the layout updated event, it will also trigger that event!

    For example:

      my_LayoutUpdatedEvent (object sender, eventArguesE) {textBlock1.Text = "void"; Console.Out.WriteLine ("text changed!"); }  

    will go into the infinite loop of the update.

    Perhaps you need to do something like this:

      zero my_BetterLayoutUpdatedEvent (object sender, event events e) {if (! Changed) text block 1. Text = "changed"; Has changed = true; Console.Out.WriteLine ("text changed!"); }  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -