Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Line's Stroke and Rectangle's Fill doesn't rendered as expected while changing the system's appearance. #13093

Closed
sthch opened this issue Dec 10, 2020 · 4 comments · Fixed by #13181
Assignees
Labels
a/darkmode a/shapes in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛

Comments

@sthch
Copy link

sthch commented Dec 10, 2020

Description

I have already set both Line's Stroke and Rectangle's Fill with AppThemeBinding, but when I changing the system's appearance in settings, their appearance doesn't change as expected. This problem occurs on both iOS and Android platforms.

Steps to Reproduce

  1. Create a Line or Rectangle.
  2. Set the Line's Stroke or Rectangle's Fill with AppThemeBinding.
  3. Run the application, change the system's appearance in settings.
  4. You'll find that the Line or Rectangle's color doesn't rendered as excepted, but if you go back and re-enter, their color can be rendered correctly.

Expected Behavior

微信截图_20201210132438

Actual Behavior

微信截图_20201210132507

Basic Information

  • Version with issue: 5.0-pre5
  • Platform Target Frameworks:
    • iOS: 14.2
    • Android: 11

Screenshots

GIF 2020-12-10 12-00-32

@sthch sthch added s/unverified New report that has yet to be verified t/bug 🐛 labels Dec 10, 2020
@jsuarezruiz jsuarezruiz self-assigned this Dec 10, 2020
@jsuarezruiz
Copy link
Contributor

Could you attach a sample where reproduce the issue?. I created a small sample but cannot reproduce it:
issue13093

@jsuarezruiz jsuarezruiz added s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels Dec 10, 2020
@sthch
Copy link
Author

sthch commented Dec 10, 2020

Could you attach a sample where reproduce the issue?. I created a small sample but cannot reproduce it:
issue13093

Thanks for the reply!
Here is my code sample:

Page.xaml:
<Line Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Style="{StaticResource HorizontalSeparator}" />
<Rectangle Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" Margin="-15,0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" WidthRequest="{Binding Source={RelativeSource Mode=Self}, Path=Width}" HeightRequest="{Binding Source={RelativeSource Mode=Self}, Path=Height}" StrokeThickness="0"> <Rectangle.Fill> <SolidColorBrush Color="{AppThemeBinding Light={StaticResource LightViewBackgroundColor}, Dark={StaticResource DarkPageBackgroundColor}}" /> </Rectangle.Fill> </Rectangle>

App.xaml:
<Style x:Key="HorizontalSeparator" TargetType="Line"> <Setter Property="X1" Value="0" /> <Setter Property="X2" Value="{Binding Source={RelativeSource Mode=Self}, Path=Width}" /> <Setter Property="Stroke"> <SolidColorBrush Color="{AppThemeBinding Light={StaticResource LightSeparatorColor}, Dark={StaticResource DarkSeparatorColor}}" /> </Setter> <Setter Property="HorizontalOptions" Value="FillAndExpand" /> <Setter Property="VerticalOptions" Value="EndAndExpand" /> </Style>

@sthch
Copy link
Author

sthch commented Dec 14, 2020

Could you attach a sample where reproduce the issue?. I created a small sample but cannot reproduce it:
issue13093

I've tried your demo, it works fine, but if I change the Fill Property to a SolidColorBrush(like the code below), the problem occurs.
<Rectangle HorizontalOptions="Start" HeightRequest="80" WidthRequest="200"> <Rectangle.Fill> <SolidColorBrush Color="{AppThemeBinding Light=Green, Dark=Red}" /> </Rectangle.Fill> </Rectangle>

@sthch
Copy link
Author

sthch commented Dec 15, 2020

@jsuarezruiz Additionally, if you set the Fill Property to a StaticResource, you must set the Fill Property to a Brush, otherwise the shape can't be rendered correctly, is that a bug?

@jsuarezruiz jsuarezruiz removed s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. s/unverified New report that has yet to be verified labels Dec 17, 2020
@jsuarezruiz jsuarezruiz added the in-progress This issue has an associated pull request that may resolve it! label Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/darkmode a/shapes in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants