Skip to content

[BUG] WPF: BindCommand cause warning in log for button declared in XAML #2037

@mgnslndh

Description

@mgnslndh

Describe the bug

If I use BindCommand to bind a view model command to a button declared in XAML like this:

this.BindCommand(ViewModel, vm => vm.DecreaseSpeed, view => view.DecreaseSpeed);

I will then get a warning in the log like this:

POCOObservableForProperty: The class ...PreviewView property DecreaseSpeed is a POCO type and won't send change notifications, WhenAny will only return a single value!

The warning is wrong since the button DecreaseSpeed is not a property on the view but a field, declared like this in XAML:

<RepeatButton Name="DecreaseSpeed" Content="Decrease"/>

Steps To Reproduce

  1. Create a view model with single command property
  2. Create a corresponding view to the view model and implement IViewFor
  3. Declare a named button in view XAML
  4. Add call to BindCommand in view constructor to bind the view model command to the button
  5. When the view model is assigned to the view the BindCommand will execute and the warning will appear in the log

I'm working on a test case to show this.

Expected behavior
I expect not to see any warnings in the log when doing something expected by the library, like binding a command to a button declared in XAML.

Environment

  • OS: Windows 10
  • Version: 9.12.0 to 9.15.4
  • Device: PC

Additional context

I have chatted with @glennawatson on slack about this issue https://reactivex.slack.com/archives/C02AJB872/p1558086054213400

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions