xamarin/Xamarin.Forms

The order of 'IsEnabled' and 'Command' should not matter

Open

#2,758 opened on May 17, 2018

View on GitHub
 (24 comments) (18 reactions) (0 assignees)C# (1,926 forks)batch import
breakinge/5 :clock5:help wantedm/high impact :black_large_square:p/0t/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

I have two buttons:

<Button
    Text="Button1"
    Command="{Binding TheCommand}"
    IsEnabled="False" />

<Button
    Text="Button2"
    IsEnabled="False"
    Command="{Binding TheCommand}" />

For some reason, the IsEnabled property is overwritten in Button2 - this enables the button incorrectly.

Button1 is disabled this way, but when I trigger TheCommand.ChangeCanExecute(), the button enables.

Expected Behavior

Both buttons stay disabled.

The matrix of this should be an && operation:

TheCommand.CanExecute() IsEnabled Final State
True True Enabled
True False Disabled
False True Disabled
False False Disabled

Actual Behavior

The button with the command applied later overwrites the enabled state.

Basic Information

  • Version with issue: 2.5.x and 3.0
  • Last known good version: unsure
  • IDE: VS2017
  • Platform Target Frameworks: all

Contributor guide