Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Windows.Markup.XamlParseException when using prism:InvokeCommandAction #2242

Closed
rehakmatej opened this issue Nov 7, 2020 · 2 comments
Assignees

Comments

@rehakmatej
Copy link

rehakmatej commented Nov 7, 2020

Description

When using prism:InvokeCommandAction to bind event to command, the System.Windows.Markup.XamlParseException is fired. In XAML editor, line with prism:InvokeCommandAction shows error XLS0503 A value of type 'InvokeCommandAction' cannot be added to a collection or dictionary of type 'TriggerActionCollection'.

Steps to Reproduce

Download Prism-Samples-Wpf repository. Open project 29-InvokeCommandAction and update file Packages.props as in the code bellow:

<PropertyGroup>
<PrismVersion>8.0.0.1909</PrismVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Update="Prism.Core" Version="$(PrismVersion)" />
<PackageReference Update="Prism.Wpf" Version="$(PrismVersion)" />
<PackageReference Update="Prism.DryIoc" Version="$(PrismVersion)" />
<PackageReference Update="Prism.Unity" Version="$(PrismVersion)" />
<PackageReference Update="System.Windows.Interactivity.WPF" Version="2.0.20525" />
</ItemGroup>

Packages.props is updated to use the lates version of prism (8.0.0.1909). The System.Windows.Interactivity.WPF package must be added to compile the project

Expected Behavior

The app should be able to compile

Actual Behavior

XAML editor shows error on line with prism:InvokeCommandAction
XLS0503 A value of type 'InvokeCommandAction' cannot be added to a collection or dictionary of type 'TriggerActionCollection'.

Basic Information

  • Version with issue: 8.0.0.1909
  • Last known good version: 7.2.0.1422
  • IDE: Visual Studio 2019

Reproduction Link

Just use project 29-InvokeCommandAction from Prism-Samples-Wpf repository and update Packages.props file as described.

@brianlagunas
Copy link
Member

The System.Windows.Interactivity.WPF package must be added to compile the project

This is your problem. This is not needed as Prism for WPF no longer uses System.Windows.Interactivity. You need to update the xmlns namespace to this:

xmlns:i="http://schemas.microsoft.com/xaml/behaviors"

@rehakmatej
Copy link
Author

rehakmatej commented Nov 16, 2020

Thank you. I have solved it by adding Microsoft.Xaml.Behaviors.Wpf instead of System.Windows.Interactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants