Skip to content

Button IsEnabled property in Windows Platform #7377

@jcmontoya

Description

@jcmontoya

Description

When I set up the Button's "IsEnabled" property, programmatically. The expected behavior is working in all platforms. However, the formatting of the button in the Windows Platform gets lost after a couple of changes. In the Android platform it works as expected.

Steps to Reproduce

  1. Create a new Maui App
  2. Add a Grid and a StackLayout with two buttons
  3. Disable of the buttons by setting IsEnabled="False"
  4. Add code to programmatically change the is enabled property.
    <Grid  BackgroundColor="Black">
          <StackLayout  Orientation="Horizontal" HorizontalOptions="Center">
            <Button x:Name="btn1" Text="Start" WidthRequest="100" Background="Green" Clicked="btn1_Clicked"></Button>
            <Button x:Name="btn2" Text="Stop" WidthRequest="100" Background="Green" Clicked="btn2_Clicked" IsEnabled="False"></Button>
        </StackLayout>
    </Grid>
   private void btn1_Clicked(object sender, EventArgs e)
    {
        btn1.IsEnabled = false;
        btn2.IsEnabled = true;
    }

    private void btn2_Clicked(object sender, EventArgs e)
    {
        btn1.IsEnabled = true;
        btn2.IsEnabled = false;
    }

5.Click on the buttons a couple of times to enable and disable them. After the first cycle both buttons will look disabled. the functionality will still be working but it is confusing for the user. This only happens in windows, not in Android or IOS.

Version with bug

Release Candidate 3 (current)

Last version that worked well

Release Candidate 3 (current)

Affected platforms

Windows

Affected platform versions

Windows 11

Did you find any workaround?

No

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions