可以将 WPF 中的 VisualStateManager 替换为 MultiTrigger 吗?

发布于 2024-07-14 05:40:15 字数 522 浏览 7 评论 0原文

这实际上涉及到创建一个可跨 WPF 和 Silverlight 运行的库。 WPF 工具包 包含 Silverlight 中包含的 VisualStateManager 的实现,以及如果 VisualStateManager 可以执行 WPF 中的 MultiTrigger 的操作,那就可以解决我的问题。

我刚刚在 MSDN 博客上找到了一篇文章讨论了 VisualStateManager 和 Triggers 的使用,但我仍然不确定 VisualStateManager 是否可以用作 MultiTriggers 的替代品。

This really relates to creating a library that works across both WPF and Silverlight. The WPF Toolkit includes an implementation of the VisualStateManager included with Silverlight, and if the VisualStateManager can do what the MultiTrigger in WPF does, that solves my problem.

I just found an article on MSDN Blogs discussing the use of VisualStateManager and Triggers, but I'm still not sure whether or not VisualStateManager can be used as a replacement for MultiTriggers.

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

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

发布评论

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

评论(1

清欢 2024-07-21 05:40:15

VisualStateManager不能完全取代WPF的MultiTrigger。 WPF 的 MultiTrigger 内置了对条件的支持。 VisualStateManager 仅支持状态。 虽然状态乍一看似乎是条件,但事实并非完全如此。 例如,在 WPF 中,您可以使用仅在按钮的内容显示“确定”时才运行的 MultiTrigger。 然而,这并不是真正的按钮状态,因此,在这种情况下不能使用 VisualStateManager。

我希望这是有帮助的,
Chad Campbell - Silverlight 2 in Action 的作者

The VisualStateManager cannot completely replace WPF's MultiTrigger. WPF's MultiTrigger has built-in support for conditions. The VisualStateManager only supports states. While states may seem like conditions at first glimpse, this is not entirely true. For instance, in WPF you could use a MultiTrigger that only runs if the content of a Button says "OK". However, this is not really a button state, because of this, the VisualStateManager cannot be used in this situation.

I hope this is helpful,
Chad Campbell - Author of Silverlight 2 in Action

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