Closed andrewstellman closed 3 weeks ago
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Verified this on Visual Studio Enterprise 17.9.0 Preview 1(8.0.3). Repro on iOS 17.0 and MacCatalyst, not repro on Windows 11 and Android 14.0-API34 with below Project: reproduce-maui-button-text-bug.zip
Im seeing the same issue in 8.0.7 with iOS 17.2. Are there any updates or a workaround for this?
Experiencing this on iOS as well. I have a button with an image and want to programmatically make the text disappear or reappear.
I hate it, but using unicode zero-width space appears to work as a workaround.
CounterBtn.Text = "\u200B";
CounterBtn.ContentLayout =
new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Left, 0);
This is reproduceable in 8.0.82 on iOS as well. This is when changing text via any means, so not just an event handler but also Bindings.
I have a reproduction here https://github.com/NeilMalcolm/MauiButtonBindingIssue
Description
There seems to be a .NET MAUI bug in the Button control where it displays text after its Text property has been set to an empty string. When a Button control's text is cleared by setting its Text property equal to "" or String.Empty, buttons that were previously also cleared the same way will display their previous values.
This only seems to happen on maccatalyst. I was unable to reproduce it on Windows or Android.
Steps to Reproduce
Add multple Button controls to a .NET MAUI page. For example:
Add a Clicked event handler that sets its text to an empty string. For example:
Run the app:
Here's a screenshot from my sample app in the repo below:
The first three buttons should be blank. The Label underneath the buttons shows the Text property values.
Link to public reproduction project repository
https://github.com/andrewstellman/reproduce-maui-button-text-bug
Version with bug
7.0.96
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
Unknown/Other
Affected platforms
macOS
Affected platform versions
No response
Did you find any workaround?
The only workaround I could find was to use a space instead of String.Empty when clearing the button label.
Relevant log output
No response