Bug 33139 - Bug in Grid Layout with CenterAndExpand when a the size of a child changes / Forms Android
Summary: Bug in Grid Layout with CenterAndExpand when a the size of a child changes / ...
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-08-16 03:13 UTC by softlion
Modified: 2016-04-13 18:26 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description softlion 2015-08-16 03:13:19 UTC
Hi, i have this layout:

<ContentPage ...
  <Grid
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Label Text="..." />
    <controls:SvgImage Grid.Row="1"
                       Svg="res:images.CercleDegrade"
                       HorizontalOptions="Fill" 
                       VerticalOptions="CenterAndExpand"
                       Clicked="OnSvgClicked"
                       BackgroundColor="Maroon" />
    <Label Text="..." Grid.Row="2" />

Nothing fancy, it just works.
When the custom SvgImage is tapped, it calls InvalidateMeasure() and returns a new size in its OnSizeRequest() (it displays a new image).
It also works.

The problem happens when the control is pressed for at least one second. Android highlights its background. When you release your finger the click event is triggered, and the control changes its size.
At this moment, the new image is displayed correctly with its new size, BUT the highlighted background and parts of the old image are still visible (if the old image was higher than the new one). 
Then if you then press anywhere on the screen these 'artifacts' disappears.

So it seems there is a redraw problem somewhere in the Xamarin Code in this specific case. It is very easy to reproduce.
For a repro project, get the XamSvg component and open the 'Android Forms' demo. Then update the Xaml so it matches the one here.
Comment 1 softlion 2015-08-16 03:14:35 UTC
Tested on 'Samsung S3 4G' on Android 4.4
Comment 2 asimk 2015-08-19 08:56:21 UTC
I have checked this issue with the help of code provided in bug description but unable to reproduce this issue. I am getting error when I am trying to set 'SvgImage' in Grid Row.
Could you please attach the sample project so that I can reproduce this issue at our end.
Comment 3 softlion 2015-08-21 13:28:01 UTC
You may use a simple Image with Source set to a jpg file instead of this control.
Comment 4 asimk 2015-08-25 08:10:47 UTC
Created attachment 12630 [details]
SampleApp

I have added component 'XamSvg' in Xamarin.forms app and I am getting exception when trying to deploy application on device.
I am attaching the sample project for the same. Please review the screencast and attached sample and let me know what additional steps we need to follow to reproduce this issue.

Screencast: http://www.screencast.com/t/tw6SYK8bdPE
Comment 5 Samantha Houts [MSFT] 2016-04-13 18:26:05 UTC
Thank you for your bug report. As we have not received the information requested, we cannot properly triage your bug and are marking it resolved.

Warm regards,
Xamarin Forms Team