Skip to content

Unpredictable choice between method overloads when binding to command #5076

@mr146

Description

@mr146

Example

XAML part:

...
<Button Command="{Binding MyHandler}" />
...

Code-behind:

...
// [1]
public void MyHandler(string x) {}
// [2]
public void MyHandler() {}
...

Expected behavior: [2] is executed
Actual behavior: [1] is executed

If we will swap methods [1] and [2], then [2] will be executed.

Also, the problem appears when CommandParameter is specified: the expected behavior is that [1] will be executed always, but actually, it depends on the order of methods.

Bonus: CommandParameter="zzz" leads to app termination after button click when the chosen overload receives int parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions