值转换器可以在不同的线程上执行吗?

发布于 2024-12-09 00:53:35 字数 119 浏览 4 评论 0原文

如果我的 Binding.IsAsync = true,那么为什么我的 ValueConverter 不在同一个“假定非 UI”线程上执行?

任何方法让它在该线程上执行吗?

If my Binding.IsAsync = true, then why doesn't my ValueConverter execute on the same "supposingly non-UI" thread?

Is there any way to make it execute on that thread?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小巷里的女流氓 2024-12-16 00:53:35

IsAsync 的文档建议只有您的属性访问器才会被异步调用。我能找到的没有提到转换器。我不完全确定这是否是因为技术上不可能在 BG 线程上调用转换器,或者可能它被忽略了。在我看来,这应该是可能的。

作为解决方法,您可以将转换器执行的任何繁重逻辑移至该属性中,或者完全移至一个单独的属性中吗?

The documentation for IsAsync suggests that only your property accessors will be called asynchronously. No mention of converters is made that I can find. I'm not entirely sure whether this is because it's technically not possible to call the converter on the BG thread, or perhaps it was overlooked. It seems to me that it should be possible.

As a workaround, can you move any heavy logic being performed by your converter into the property, or perhaps into a separate property altogether?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文