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

Migrating Color and VisualStateManager #6454

Open
david-maw opened this issue Apr 24, 2022 · 7 comments
Open

Migrating Color and VisualStateManager #6454

david-maw opened this issue Apr 24, 2022 · 7 comments
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@david-maw
Copy link

david-maw commented Apr 24, 2022

Description

The behavior of Color and VisualStateManager in MAUI is sufficiently different that migration is challenging. I've commented on some aspects of this before (see issue #1668) but the combination of several design decisions makes migration especially painful.

The attached example, a simple single page application with a label and 3 entry fields shows some of the issues.

Steps to Reproduce

  1. Unzip the Xamarin solution from Simple-VisualStateManager-Xamarin.zip
  2. Compile and run it on Android, you should see what's below. Click on the three entry lines in succession to see the first and second highlighted in yellow when they are selected. Completely independently, the label should change color every 3 seconds):
    Simple-VisualStateManager-Xamarin-Android
  3. Unzip the MAUI project from: Simple-VisualStateManager-MAUI.zip
  4. Compile and run it under Android then click on the three entry lines in succession and you should see this:
    Simple-VisualStateManager-MAUI-Android
  5. Repeat under Windows and you should see this:
    Simple-VisualStateManager-MAUI-Windows

Comparing the code in MainPage.xaml.cs between Xamarin and MAUI the significant changes are:

The other issues are with the XAML and especially with the VisualStateManager implementations. The first VisualStateManager sets an Entry background color in a Focused state and specifies nothing for a Normal state which means switching back to a Normal state sets BackGroundColor to null. Taken in conjunction with pull request #1485 this means the switch back is ignored and the Selected background color persists. Again for new code there's a fairly easy workaround, for existing code it's trickier.

Finally, there are the other functional differences in the MAUI version of the sample:

  1. On Android the second entry field is not underlined.
  2. On Android the placeholder text begins slightly to the left of where it should on the second entry line.
  3. On Android in Xamarin forms the selected Entry gets a red underline, on MAUI it does not.
  4. On Windows the VisualStateManager specifications seem to have no effect at all.

Version with bug

Release Candidate 1 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 11, Windows 10

Did you find any workaround?

Sometimes. See above (and the code)

Relevant log output

No response

@david-maw david-maw added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Apr 24, 2022
@kristinx0211 kristinx0211 added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Apr 24, 2022
@kristinx0211
Copy link

verified repro on android 11 and windows with the above project.

@Redth Redth added the area-xaml XAML, CSS, Triggers, Behaviors label Apr 25, 2022
@Redth Redth added this to the 6.0.300 milestone Apr 25, 2022
@StephaneDelcroix StephaneDelcroix removed the t/bug Something isn't working label Apr 27, 2022
@StephaneDelcroix
Copy link
Contributor

could you be specific on what isn't working for you ?

@david-maw
Copy link
Author

Sorry, I thought I was being specific, the part of the issue description beginning "Comparing the code in MainPage.xaml.cs between Xamarin and MAUI" describes the changes in words though it isn't explicit about the challenges of migrating color specifications of "Default" or "Accent" in XAML.

The preceding section tries to illustrate the effect of the changes.

In general just try and convert the Xamarin MainPage.xaml and MainPage.xaml.cs to MAUI - it is challenging to do and the results of a simple conversion are poor.

Is there some specific area of my description that's unclear?

@david-maw
Copy link
Author

@StephaneDelcroix Just noticed I didn't specifically mention you in the previous comment so I'm doing so now in case you didn't see my response.

@Bowman74
Copy link

@StephaneDelcroix I am looking at converting a project that uses Color.Default so this is a real issue.

@mattleibow mattleibow modified the milestones: 6.0.300, 6.0-servicing Aug 29, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

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.

@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 5, 2023
@samhouts samhouts added the t/bug Something isn't working label Jul 31, 2023
@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Aug 3, 2023
@Zhanglirong-Winnie
Copy link
Collaborator

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 5.0. Can repro on windows and android platform with sample project.
Simple-VisualStateManager-MAUI.zip
Simple-VisualStateManager-Xamarin.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/android 🤖 platform/windows 🪟 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