Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ToolbarItem] IsEnabled property false not working #13257

Open
Strypper opened this issue Feb 10, 2023 · 9 comments
Open

[ToolbarItem] IsEnabled property false not working #13257

Strypper opened this issue Feb 10, 2023 · 9 comments
Labels
area/toolbar platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@Strypper
Copy link

Description

The button bar is not disable when set IsEnable to false

Steps to Reproduce

<app:BasePage.ToolbarItems>
        <ToolbarItem
            Command="{x:Binding OpenUrlCommand}"
            CommandParameter="{x:Binding ControlGroup.MicrosoftStoreLink}"
            IconImageSource="{x:StaticResource MicrosoftStoreIcon}"
            IsEnabled="False"
            Text="Source code" />
        <ToolbarItem
            Command="{x:Binding OpenUrlCommand}"
            CommandParameter="{x:Binding ControlGroup.ProviderUrl}"
            IconImageSource="{x:StaticResource InfoIcon}"
            Text="Original Document" />
    </app:BasePage.ToolbarItems>

Link to public reproduction project repository

https://github.com/Strypper/mauisland

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

Windows 11 - Android 12

Did you find any workaround?

No

Relevant log output

None
@Strypper Strypper added the t/bug Something isn't working label Feb 10, 2023
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Feb 13, 2023
@ghost
Copy link

ghost commented Feb 13, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@Laim
Copy link

Laim commented Feb 20, 2023

I am seeing this same issue (.NET 6), setting it to False doesn't seem to disable it.

@Strypper
Copy link
Author

This also happen on Windows, I don't have a mac device to test on IOS and Catalyst

@AlexeyStarkov
Copy link

AlexeyStarkov commented Feb 26, 2023

Facing a similar issue: the Button control with "False" value assigned to IsEnabled stays enabled after startup.

@SF-Simon
Copy link

SF-Simon commented Mar 11, 2023

System.InvalidOperationException:“The BindableProperty "IsEnabled" is readonly.”

        <MenuBarItem Text="Locations">
            <MenuFlyoutItem
                Command="{Binding AddLocationCommand}"
                IsEnabled="false"
                Text="Add Location" />
        </MenuBarItem>

image

Direct crash, read only?
However, the document and code both display {get; set;}.

Is MAUI a toy? Can't complete any complicated work. The response to the problem and the update speed are extremely slow, which is really frustrating.

@Laim
Copy link

Laim commented Mar 11, 2023

System.InvalidOperationException:“The BindableProperty "IsEnabled" is readonly.”


        <MenuBarItem Text="Locations">

            <MenuFlyoutItem

                Command="{Binding AddLocationCommand}"

                IsEnabled="false"

                Text="Add Location" />

        </MenuBarItem>

image

Direct crash, read only?

However, the document and code both display {get; set;}.

Is MAUI a toy? Can't complete any complicated work. The response to the problem and the update speed are extremely slow, which is really frustrating.

Are you getting a crash when it's set to False? For me it just stays enabled but doesn't crash

@SF-Simon
Copy link

System.InvalidOperationException:“The BindableProperty "IsEnabled" is readonly.”


        <MenuBarItem Text="Locations">

            <MenuFlyoutItem

                Command="{Binding AddLocationCommand}"

                IsEnabled="false"

                Text="Add Location" />

        </MenuBarItem>

image
Direct crash, read only?
However, the document and code both display {get; set;}.
Is MAUI a toy? Can't complete any complicated work. The response to the problem and the update speed are extremely slow, which is really frustrating.

Are you getting a crash when it's set to False? For me it just stays enabled but doesn't crash

If I start the project without debugging mode, I will exit directly. (This is collapse, right?)
If I use debug mode, I will give a more detailed error, which is the error mentioned above.

I didn't actually release the project. I originally wanted to transplant my software from MacOS. After studying for about 7 days, I found a lot of unpleasant places. And no matter how you ask people, it's like talking to a tree hole

@jinxinjuan jinxinjuan added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Jun 9, 2023
@jbtdevgit
Copy link

jbtdevgit commented Sep 22, 2023

I checked the code and I believe the IsEnabled is not included yet, though it is weird that they put a property that is not implemented yet. I have a workaround for this if you want to disable it, but pretty limited since you cannot do a binding on it. All you have to do in your RelayCommand where the toolbar item is binded is to add a parameter to it.

[RelayCommand]
private void YourButton(string unecessaryParam)
{}

This should disable the toolbar

@kimhongka
Copy link

I'm getting the same issue.
According to MAUI document, I can see they want to use CanExecute in Commanding to enable/disable the toolbarItem.
Screenshot 2024-01-05 at 9 19 44 am

I have followed it and it works as it expected (it greyed out when it's disabled) for iOS, however it does not grey out for Android. Functionally, it's disabled, the function of the toolbaritem disabled, but the text colour is still showing as white.

i.e In Android only, CanExcute property

  1. initial setting the property as false(greyed out and function not available) - worked
  2. from false to true (changed the colour back to white and function available) - worked
  3. from true to false (text colour remained white and function not available) - not working for the Text colour

I've tried to use IsEnabled property binding way, the behaviour is the same.

I think somewhere in MAUI, it dose not raise the property change for isEnabled or ChangeCanExecute when it set to false.

This issue should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/toolbar platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants