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

ListView not change BackgroundColor when Theme is changed on iOS #16531

Open
Neotrickster opened this issue Aug 3, 2023 · 7 comments
Open

ListView not change BackgroundColor when Theme is changed on iOS #16531

Neotrickster opened this issue Aug 3, 2023 · 7 comments
Labels
area-controls-listview ListView and TableView platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@Neotrickster
Copy link

Neotrickster commented Aug 3, 2023

Description

ListView is not changing BackgroundColor when Theme is changed on iOS but it works perfectly on Android.
I´m using Visual Studio 2022 17.6.5 (and still on VS 2022 17.7)

Untitled-3

Steps to Reproduce

Using the sample App ThemingDemo, add a ListView in UserSummaryPage.xaml:

             <ListView Grid.Row="3"
                  x:Name="ytListView"
                  BackgroundColor="{DynamicResource PageBackgroundColor}"
                  SeparatorColor="Blue"
                  >
            <ListView.ItemsSource>
                <x:Array Type="{x:Type x:String}">
                    <x:String>Baboon</x:String>
                    <x:String>Capuchin Monkey</x:String>
                    <x:String>Blue Monkey</x:String>
                    <x:String>Squirrel Monkey</x:String>
                    <x:String>Golden Lion Tamarin</x:String>
                    <x:String>Howler Monkey</x:String>
                    <x:String>Japanese Macaque</x:String>
                </x:Array>
            </ListView.ItemsSource>
        </ListView>

Link to public reproduction project repository

https://github.com/Neotrickster/ThemingDemo

Version with bug

7.0.49

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

16.4, 16.2, 13.7

Did you find any workaround?

none

Relevant log output

none
@Neotrickster Neotrickster added the t/bug Something isn't working label Aug 3, 2023
@Eilon Eilon added the area-controls-listview ListView and TableView label Aug 3, 2023
@mattleibow mattleibow added the s/needs-repro Attach a solution or code which reproduces the issue label Aug 11, 2023
@ghost
Copy link

ghost commented Aug 11, 2023

Hi @Neotrickster. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@mattleibow mattleibow added the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Aug 11, 2023
@ghost
Copy link

ghost commented Aug 11, 2023

Hi @Neotrickster. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Neotrickster
Copy link
Author

I already tried new MAUI versión( the one packed with visual studio 17.7), but the bug still there.

The link for sample code to reproduce is:

https://github.com/Neotrickster/ThemingDemo

Is the sample app plus a ListView

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Aug 11, 2023
@mattleibow mattleibow added platform/iOS 🍎 and removed s/needs-attention Issue has more information and needs another look labels Aug 16, 2023
@mattleibow mattleibow added this to the Backlog milestone Aug 16, 2023
@ghost
Copy link

ghost commented Aug 16, 2023

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.

@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Aug 17, 2023
@XamlTest
Copy link
Collaborator

Verified this on Visual Studio Enterprise 17.8.0 Preview 1.0. Repro on iOS 16.4 .NET 8, not repro on Android 13.0-API33 with below Project:
ThemingDemo.zip

For Windows: The BackgroundColor is changed, but the text in List View is not changed.
image

image

@ramonB1996
Copy link

ramonB1996 commented Feb 12, 2024

This issue is still present in the latest version.

Using DynamicResource or AppThemeBinding as the backgroundcolor of your ListView does NOT work.

There is a workaround for now: Give the ListView a BackgroundColor=Transparent and put it inside a Grid (or a different container for that matter). Give the Grid the DynamicResource you wanted to give the ListView initially.

@kevinjohnobrien
Copy link

@ramonB1996 Thank you.

I was able to achieve a similar result within a ListView using FlexLayout...
<FlexLayout Direction="Row" JustifyContent="SpaceBetween" BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}">...

But setting BackgroundColor="Transparent" within the ListView was key to making the entire ListView set to the required background colour.

As an interesting aside, SeparatorColor="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource White}}" works fine within a ListView, even if BackgroundColor doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-listview ListView and TableView platform/iOS 🍎 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

6 participants