xamarin/Xamarin.Forms

Behavior of Page with both BackgroundColor and BackgroundImage set

Aperta

#5067 aperta il 26 gen 2019

 (6 commenti) (0 reazioni) (0 assegnatari)C# (1926 fork)batch import
breakinge/2 :clock2:good first issuehelp wantedinactivep/Androidt/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

While working on PR #5066 for #5057 I noticed a potential issue when Page has both BackgroundColor and BackgroundImage set.

Steps to Reproduce

  1. Set BackgroundColor="Red"

  2. Set BackgroundImage="someimage.jpg" On all platforms, image is shown.

  3. Set BackgroundColor=Color.Default iOS and UWP: image stays. This is because BackgroundImage is handled first before BackgroundColor, image takes priority over color. Android: image is gone, white background appears. Android doesn't handle the priority.

  4. Set BackgroundColor="Red" iOS and UWP: image stays Android: background is Red

  5. Set BackgroundImage=null iOS and UWP: Yay, background is finally red again! Android: Background is now white!

I attached a video with the described steps. pagebkgnd.zip

Expected Behavior

I'm not sure, I haven't been able to find it mentioned in the documentation portal what's expected to happen when both properties are set.

My proposal: like on iOS and UWP, have BackgroundImage take priority over BackgroundColor. When clearing the BackgroundImage, the Page should look with a background color of BackgroundColor.

Please let me know how you'd like this implemented, and I'd like to work on it

Actual Behavior

See it described in the steps above.

Basic Information

Latest code from my PR #5066.

Guida contributor