xamarin/Xamarin.Forms

Behavior of Page with both BackgroundColor and BackgroundImage set

开放

#5,067 创建于 2019年1月26日

 (6 条评论) (0 个反应) (0 位负责人)C# (1,926 个派生)batch import
breakinge/2 :clock2:good first issuehelp wantedinactivep/Androidt/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南