events - WPF Window.Loaded and Window.Closed -


There are two event triggers one of them round events window.loaded And other windows.closed . But both do not work at the same time. How can I fix the problem?

My code is below

  & lt; Window.Triggers & gt; & Lt; Event Trigger Routing Avent = "Window Close" & gt; & Lt; BeginStoryboard & gt; & Lt; Storyboard & gt; & Lt; DoubleAnimation Storyboard TargetName = "mainWindow" storyboard. TargetProperty = "Left" from "= 500" = "- 200" Period = "0: 0: 1" & gt; & Lt; / DoubleAnimation & gt; & Lt; / Storyboard & gt; & Lt; / BeginStoryboard & gt; & Lt; / EventTrigger & gt; & Lt; Event Trigger Routing Avent = "Window Loaded" & gt; & Lt; BeginStoryboard & gt; & Lt; Storyboard & gt; & Lt; Double animation storyboard TargetName = "mainWindow" storyboard. TargetProperty = "Left" = "- 200" from = "500" period = "0: 0: 1" /> & Lt; / Storyboard & gt; & Lt; / BeginStoryboard & gt; & Lt; / EventTrigger & gt; & Lt; /Window.Triggers>    

window.loaded works fine, problem That EventTriggers works only for routed events, but the Window.Closed event is not routed (because there is something that can only be in one window ).

I suggest you to code- to close the action in the window. To handle the event. This is understandable in any way, because you actually In order to close the window, the animation has to wait for the end of the animation.

Comments