【问题标题】:CallMethodAction: can it be used in WPF?CallMethodAction:可以在 WPF 中使用吗?
【发布时间】:2013-04-25 15:52:03
【问题描述】:

当我在 MVVM-WPF 中使用 CallMethodAction 时,我收到此错误:

命名空间中不存在“CallMethodAction” “http://schemas.microsoft.com/expression/2010/interactions”。

知道我在我的 xaml 中包含以下命名空间:

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"

如果只用于 SL,WPF 中的等价物是什么

【问题讨论】:

  • Interaction dll 总是会出现很多引用错误,请确保 dll 在您的项目中并且应该在 packages 文件夹中

标签: wpf


【解决方案1】:

CallMethodAction 位于 http://schemas.microsoft.com/expression/2010/interactions 命名空间中。

您需要在项目中添加对Microsoft.Expression.Interactions.dll 的引用。

【讨论】:

    【解决方案2】:

    我用这是 wpf 来表达惰性

    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    

    确保添加对您项目的引用

    然后我将它添加到一个组合框:

                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="SelectionChanged">
                                your binding here
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
    

    【讨论】:

    • 我将 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 替换为 xmlns:i="schemas.microsoft.com/expression/2010/… 在某些论坛中的建议,但在两种情况都出现相同的错误
    • 你确定你的项目引用了dll
    【解决方案3】:

    这可能是由于链接 .dll 中存在冲突库所致。从项目中删除不必要的链接。我有这些指向 Microsoft.Office.Interop 的链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-11
      • 2014-02-24
      相关资源
      最近更新 更多