roubachof/Sharpnado.CollectionView

Background color didn't work correct while real-time theme switching

Opened this issue · 2 comments

Platform:

  • iOS
  • Xcode 12.5.1
  • Xamarin.Forms 5.0.0.2083

Describe the bug
When i set background color for HorizontalListView like following:
BackgroundColor = "{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}"
and switch theme by iOS simulator settings (without restarting emulator), by Features->Toggle Appearance in iOS simulator menu - color didn't changed

To Reproduce

  • Create HorizontalList view with static defined colours for different themes
  • Switch theme by device emulator

Could you please help to resolve this issue?

Sorry for the long reply.

So, when using something like that

<sho:CollectionView
BackgroundColor = "{AppThemeBinding Light=#ffffff, Dark=#000000}"
IsDragAndDropping = "True"
DragAndDropDirection = "Free"
DragAndDropTrigger = "Pan"
ColumnCount = "2"
CollectionLayout = "Vertical"
SnapStyle = "Center"
CollectionPadding = "20,15,20,0"/>

When using iOS theme switch by Features->Toggle Appearance in iOS simulator menu expected background color in dark mode is black (as it set as #000000) and white for light mode.

But color didn't change while theme switch.
If you need additional details please write what information you expect and i'll try to send it ASAP.

Thank you for excellent project.

Same problem: ListView BackgroundColor does not work properly with AppThemeBinding on iOS:

<ListView BackgroundColor="{AppThemeBinding Light=White, Dark=Black}" ....

Reproduce: Run on iOS Simulator => Change theme (CMD + SHIFT + A).
Result:

  1. First time ListView does not update to new theme. Second, 3rd, 4th time, etc ListView updates but uses the wrong theme (light when it should be dark and dark when it should be light).
  2. When interacting with the ListView, the correct theme is set.
  3. Same happens on real device.
  4. This works properly on Android.

Workaround is to set ListView BackgroundColor to transparent and use a grid or the page as background.