Bug 30765 - Styles with Frames does not apply the "Padding" property
Summary: Styles with Frames does not apply the "Padding" property
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 1.4.4
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2015-06-04 00:26 UTC by Tyler_hartwig
Modified: 2017-09-25 11:09 UTC (History)
15 users (show)

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

Test Project displaying bug (64 bytes, text/plain)
2015-06-04 00:36 UTC, Tyler_hartwig
Quick fix for Jason (324.38 KB, patch)
2016-04-22 12:20 UTC, n.podbielski

Description Tyler_hartwig 2015-06-04 00:26:42 UTC
When writing a Xamarin.Forms app using XAML and Styles, the Padding property of a style is not applied for Frame views.  I have attempted this on both iOS and Android, and neither apply this particular style property.  Here is the XAML code I created, it is also in the attached project.  

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="FormsFrameBug.FramesPage">
			<Style TargetType="Frame">
				<Setter Property="Padding" Value="0" />
				<Setter Property="VerticalOptions" Value="CenterAndExpand" />
			<Style TargetType="Frame" x:Key="ExplicitStyle">
				<Setter Property="Padding" Value="0" />
				<Setter Property="VerticalOptions" Value="CenterAndExpand" />
			<Frame BackgroundColor="Blue">
				<BoxView BackgroundColor="Red" />
			<Frame Style="{StaticResource ExplicitStyle}" BackgroundColor="Yellow">
				<BoxView BackgroundColor="Red" />
			<Frame BackgroundColor="Lime" Padding="0">
				<BoxView BackgroundColor="Red" />

I believe each of the Frame Views in this stack layout should be rendered identically, as each of their padding properties should be 0.  The sample also displays that the issue occurs with both implicit and explicit styles.
Comment 1 Tyler_hartwig 2015-06-04 00:31:56 UTC
I also failed to mention that I have experienced this both in a PCL Project and a Shared Project, in case that is relevant
Comment 2 Tyler_hartwig 2015-06-04 00:36:54 UTC
Created attachment 11458 [details]
Test Project displaying bug
Comment 3 Nathan Castle 2015-09-24 21:27:13 UTC
A user in the forum ran into this issue (http://forums.xamarin.com/discussion/51824/frame-padding-can-it-still-be-changed). I can confirm that it is still present in 1.5.0.
Comment 4 adrianknight89 2016-01-28 23:20:28 UTC
I have this issue as well. This shouldn't be too difficult to fix. Not sure why it's been months without progress.
Comment 5 Jason Smith [MSFT] 2016-04-09 01:28:24 UTC
Because it presents a backwards compat issue and a proper fix requires work into the binding system :/

It's still on our list.
Comment 6 n.podbielski 2016-04-22 11:54:10 UTC
>and a proper fix requires

Then do *unproper* fix. Seriously you are adding new features every major release and can't fix this that kind of annoying bugs.
Comment 7 n.podbielski 2016-04-22 12:19:15 UTC
Here is @Jason quick fix for you (add this method to Frame class and you done):

protected override void OnPropertyChanged(string propertyName = null)
            if (propertyName == StyleProperty.PropertyName)
                if (Style.Setters.Any(s => s.Property == PaddingProperty))
                    Padding = (Thickness)Style.Setters.First(s => s.Property == PaddingProperty).Value;
Comment 8 n.podbielski 2016-04-22 12:20:29 UTC
Created attachment 15817 [details]
Quick fix for Jason
Comment 9 tim.ahrentlov 2016-07-14 17:07:09 UTC
Just ran into this as well in 2.3-pre2. I believe a fix is due.
Comment 10 Mat 2017-03-21 17:19:52 UTC
Ran into this on
Comment 11 Stephane Delcroix 2017-05-30 08:20:39 UTC
see https://github.com/xamarin/Xamarin.Forms/pull/943
Comment 12 Stephane Delcroix 2017-06-01 07:55:36 UTC
will be fixed in 2.3.6-pre1
Comment 13 Andree Romoth 2017-08-30 12:58:00 UTC
I can reproduce this in 

Tested on:

iOS 10.3 Simulator, 
iPhone 6S iOS 9.3.5 
LG Nexus 5 Android 6.0.1

Applying Padding via Style does not work.
Comment 14 Andree Romoth 2017-08-30 13:10:30 UTC

read wrong version in comment above .. :D

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

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.

Note You need to log in before you can comment on or make changes to this bug.