microsoft/XamlBehaviorsWpf

XAMLBehaviorsSample.InvokeCommandControl Binding is incorrect and some code is HTML encoded.

smeddows opened this issue · 7 comments

Describe the bug
On line 38 of the InvokeCommandControl.xaml file the CommandParameter binding is incorrect. That current binding passes null to the command class as a parameter. There is almost a binding failure displayedin Visual Studio:

Severity Count Data Context Binding Path Target Target Type Description File Line Project
Error 1 InvokeCommandControl Grid.Background InvokeCommandAction.CommandParameter Object Grid property not found on object of type InvokeCommandControl.

The binding currently looks like this:
CommandParameter="{Binding Grid.Background}"

It will work correctly like this:
CommandParameter="{Binding Background, ElementName=Grid}"

Expected behavior
I expect the command parameter to have the value of the Background property from the Grid object. Instead, the value is null.

Reproduction Link

Please see code located here: InvokeCommandControl.xaml

I would be happy to provide a pull request to fix this if you guys would like this sample cleaned up.

Thanks

Well that's weird. Great find. Yes, please submit a PR to fix this.

@brianlagunas , would you prefer that I just take the whole parameter out or do you think it's better to cast it when executing the command?

Since the MVVM pattern is not being used, you can just cast the value directly in the command.

I keep getting a 403 error when trying to create the PR from Visual Studio:

Failed to push to the remote repository. See the Output window for more details.
Pushing master
Remote: Permission to microsoft/XamlBehaviorsWpf.git denied to smeddows.
Error encountered while pushing to the remote repository: Git failed with a fatal error.
Git failed with a fatal error.
unable to access 'https://github.com/microsoft/XamlBehaviorsWpf/': The requested URL returned error: 403

Fork the repo instead.

PR Here: #145

Thanks for the PR.