Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Button.IsEnabled does not work #18

Open
sandeepc24 opened this issue Feb 6, 2020 · 7 comments
Open

Button.IsEnabled does not work #18

sandeepc24 opened this issue Feb 6, 2020 · 7 comments

Comments

@sandeepc24
Copy link
Contributor

Following does not disable the button.

                Button.button [ 
                    Button.Text "Test"
                    Button.IsEnabled false
                ]
@Zaid-Ajaj
Copy link
Owner

Hello @sandeepc24,

Do you happen to have the latest version of this library?

@sandeepc24
Copy link
Contributor Author

Hi @Zaid-Ajaj

I am using the latest version of the lib.

@sandeepc24
Copy link
Contributor Author

Looking at the code I can't say why it's not working, IsVisible is similar to this property and it works.

@Zaid-Ajaj
Copy link
Owner

I can't tell for sure why it is not working. Does the equivalent code from the original DSL not disable the button either? i.e. if you write:

View.button(text="whatever", isEnabled=false)

Is the button then still not disabled? if that is the case, then you file an issue on the Fabulous repository instead

@sandeepc24
Copy link
Contributor Author

sandeepc24 commented Feb 7, 2020 via email

@Blener
Copy link
Collaborator

Blener commented Feb 20, 2020

Hello,
I tried the code inside the SimpleFabimals sample and the button is disabled (as the image shows). Enabling the button also works.
I'm using the latest packages from Fabulous, Xamarin and SimpleElements.

Please, is there any sample code that I can try @sandeepc24 ?

image

@Blener
Copy link
Collaborator

Blener commented Nov 17, 2020

I got a similar issue today during work, but in my case if the button has the command set then it's always enabled.

let view (model: Model) (dispatch: Msg -> unit) =
        View.ContentPage(
          content = View.StackLayout(padding = Thickness 20.0, verticalOptions = LayoutOptions.Center,
            children = [
                Button.button [
                    Button.Text "Disabled with command"
                    Button.IsEnabled false
                    Button.OnClick ignore
                ]
                Button.button [
                    Button.Text "Disabled without command"
                    Button.IsEnabled false
                ]
                View.Button(text = "Disabled with command", isEnabled = false, command = ignore)
                View.Button(text = "Disabled without command", isEnabled = false)
            ]))

The code above generates this:
image

This happens regardless of using SimpleElements or not. I opened the issue in Fabulous repo.

Edit: As stated in the Fabulous issue, this is the default for Xamarin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants