问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/32696822/a-value-of-type-popupwindowaction-cannot-be-added-to-a-collection-or-dictionar