问题描述
我广泛使用 Expression 交互的 CallMethodAction 以对 MVVM 友好的方式处理来自 XAML 的事件.
I make extensive use of Expression interactions' CallMethodAction to handle events from XAML in a MVVM-friendly way.
我刚刚在 VS2017 中创建了一个新的 WPF 项目,现在我看到旧的 Expression 命名空间已经消失了.我发现 这个页面在 MSDN 上,这是我正在寻找的操作,但是在引用了该程序集并添加了它不包含 CallMethodAction 的命名空间之后.该页面适用于 Silverlight,这是 WPF,所以我担心该操作不再可用.
I have just created a new WPF project in VS2017 and now I see the old Expression namespace is gone. I found this page on MSDN which is the action I'm looking for but after referencing that assembly and adding the namespace it does not contain the CallMethodAction. That page is for Silverlight and this is WPF, so I'm concerned that action is no longer available.
那么有谁知道它是否实际上已被删除/替换?现在应该如何在视图模型上调用事件处理程序?
So does anyone know if it has in fact been removed/replaced? How is one supposed to call event handlers on the viewmodel now?
(我知道 InvokeCommandAction,但我更喜欢 CallMethodAction,因为它中继原始事件参数,并允许取消预览事件.)
(I do know about InvokeCommandAction, but I prefer CallMethodAction since it relays the original event arguments, and allows for canceling preview events.)
编辑:为了继续前进,我尝试了 InvokeCommandAction,但它的工作方式也不再相同,而且我找不到任何关于新用法的文档.
Edit: Just to move forward I tried InvokeCommandAction but it no longer works the same way either and I cannot find any documentation on the new usage.
我确实找到了 Microsoft.Xaml.Interactions 命名空间在 MSDN 上的此参考 似乎包含我需要的类,但该程序集似乎不存在.
I did find this reference on MSDN for the Microsoft.Xaml.Interactions namespace which appears to contain the classes I need, but that assembly doesn't appear to exist.
我觉得我在这里遗漏了一些明显的东西.我不明白他们如何能够对响应事件这样基本的事情做出重大改变.
I feel like I'm missing something obvious here. I don't see how they could make a breaking change to something as basic as responding to events.
推荐答案
使用 Visual Studio 2017 安装程序安装Blend for Visual Studio SDK for .NET",您可以在单个组件"页面上找到SDK、库和框架"标题.
Use the Visual Studio 2017 installer to install "Blend for Visual Studio SDK for .NET", which you can find on the "Individual components" page, under the "SDKs, libraries, and frameworks" heading.
这篇关于Visual Studio 2017 - 表达式交互发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!