I wanted to know if is there a way to do something (call function...) every frames in a WPF application, like "update()" in Unity, or like "Application.Idle += new EventHandler(Application_Idle)" in a Winform app ? Thanks.
-
update() and Application.Idle are pretty different in their domain context. Are you sure these are the correct ones for your case?VidasV– VidasV2017-05-16 13:04:22 +00:00Commented May 16, 2017 at 13:04
-
Maybe, I'm just searching something which can call some code each frame the app is running.0_yami_0– 0_yami_02017-05-16 13:17:26 +00:00Commented May 16, 2017 at 13:17
Add a comment
|
3 Answers
Is it related purely to UI rendering events? If so, try looking into CompositionTarget.Rendering event.
1 Comment
0_yami_0
Not about rendering, only to process.
It sounds like you probably want to just use a Dispatcher timer. How do I create a timer in WPF?
The update time in unity is based on many factors but generally at 60 frames a second so the timer interval would be something like 17ms. However you should know wpf doesn't really have frames like unity so there is no update equivalent. It only updates the layout when something moves/added/changed or you call InvalidateLayout to force it to do so.