How WPF Converters are executed?

若如初见. 提交于 2019-12-10 19:09:11

问题


I'm facing render issues in very complex WPF UI which contains, among other things, a lot of Converters (IValueConverter, IMultiValueConverter).

I would like to know if the converters could be involved into this.

Does anyone known how WPF Converters worked ? Are they executed in parallel and then synchronized with the UI thread ? or is there some kind of foreach loop that treat every converter ?


回答1:


The converters are executed on the UI-thread, you can test this by blocking the thread using something like Thread.Sleep(10000). The UI is managed in a dispatcher queue, see the threading model reference for more information, updates to bindings are pushed into that queue. Converters are called if the binding was updated, they normally are not being called at the same time.

(Also see the good comments below)



来源:https://stackoverflow.com/questions/6865912/how-wpf-converters-are-executed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!