且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法将“PopupWindowAction"类型的值添加到“TriggerActionCollection"类型的集合或字典中

更新时间:2022-11-21 09:49:04

您使用的是 Visual Studio 2015 吗?我在 VS 2015 中遇到了类似的问题,但在 VS 2013 中没有,我首先认为 Prism 框架中的二进制文件有问题.我在 Prism GitHub 上发布了一个问题:

https://github.com/PrismLibrary/Prism/issues/213

最终对我有用的事情是重新安装 VS 2015.我怀疑 VS 2015 的一些可选扩展/插件导致了这个问题.希望这也能解决您的问题.

Refer to Prism manual I made my modal view and pasted it in main view like this:

<baseView:BaseView ... >
    <i:Interaction.Triggers>
        <prism:InteractionRequestTrigger SourceObject="{Binding DocumentSelectionRequest, Mode=OneWay}">
            <prism:PopupWindowAction IsModal="True">
                <prism:PopupWindowAction.WindowContent>
                    <modal:DocumentSelectionView />
                </prism:PopupWindowAction.WindowContent>
            </prism:PopupWindowAction>
        </prism:InteractionRequestTrigger>
    </i:Interaction.Triggers>
<Grid>
...
</Grid>
</baseView:BaseView>

But I have got the compile time error in <prism:PopupWindowAction IsModal="True"> (in run time everything is perfect):

Error 3 A value of type 'PopupWindowAction' cannot be added to a collection or dictionary of type 'TriggerActionCollection'.

In my project I use PRISM 5 and .NET 4.5

UDP:

Namespaces are defined (in baseView:BaseView) like:

xmlns:prism="http://www.codeplex.com/prism"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

References:

Microsoft.Practices.Prism.Interactivity Version 5.0.0.0

System.Windows.Interactivity Version 4.5.0.0

Are you using Visual Studio 2015? I was having a similar problem with VS 2015, but not in VS 2013, and I first thought something was wrong with the binaries from the Prism framework. I posted an issue on the Prism GitHub:

https://github.com/PrismLibrary/Prism/issues/213

The thing that worked for me, eventually, was reinstalling VS 2015. I suspect that some of the optional extensions/plugins for VS 2015 was causing the problem. Hopefully this will solve your troubles too.