Bug 55135 - Margin issue with controls in a ViewCell
Summary: Margin issue with controls in a ViewCell
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-04-13 07:33 UTC by Dániel Buga
Modified: 2017-07-12 22:51 UTC (History)
3 users (show)

Tags: ios, android, uwp, viewcell, margin, layout, AC
Is this bug a regression?: No
Last known good build:


Attachments
repro project (294.36 KB, application/x-zip-compressed)
2017-04-14 18:20 UTC, Jimmy [MSFT]
Details


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 for Bug 55135 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Dániel Buga 2017-04-13 07:33:21 UTC
The following snippet results in a list view where the elements have a bottom-only margin. Problem is present in 2.3.5-beta1, on both Windows and Android. When the label is nested in a frame, the margin is added correctly on all sides.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:system="clr-namespace:System;assembly=System.Runtime"
             xmlns:generic="clr-namespace:System.Collections.Generic;assembly=System.Collections"
             x:Class="MyApp.Views.MarginTestPage"
             Title="MarginTest">

    <ListView>
        <ListView.ItemsSource>
            <generic:List x:TypeArguments="system:String" x:Key="ListViewItems">
            <x:String>Foo</x:String>
            <x:String>Bar</x:String>
            <x:String>Baz</x:String>
            </generic:List>
        </ListView.ItemsSource>

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Label Text="{Binding .}" Margin="5" />
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</ContentPage>
Comment 1 Jimmy [MSFT] 2017-04-14 17:32:51 UTC
Thank you for reporting this! Let me try to reproduce the issue you described and I will update the report with my results.
Comment 2 Jimmy [MSFT] 2017-04-14 18:20:28 UTC
Created attachment 21558 [details]
repro project

I was able to reproduce this issue using the project that I've attached.

The controls in the ViewCell do not appear to correctly use the margin set in the Xaml, even if they are inside a layout. However, if they are wrapped in a Frame, then the margins are correct.

This is happening on iOS, Android and UWP. I am confirming this report and the team will investigate further.


### Version Tests
2.3.5-pre1  BAD
2.3.4.231   BAD
2.3.3.193   BAD


### Workaround
Wrap the controls in a Frame
Comment 3 Dániel Buga 2017-04-15 10:46:44 UTC
Thank you for confirming.

Although I haven't tried your attached repro project, my own code is working (well, based on your tests I should say 'seems to work', at least visually it's good) as intended on 2.3.4.231, at least on PC UWP (the only thing I can try right now) and breaks on 2.3.5.233 when nothing else is changed but the XF packages.
Comment 4 Rui Marinho 2017-06-19 17:39:13 UTC
Still on 2.3.6-111