Xamarin Team,
I have been trying to use RelativeLayout for my application, and I've also been trying to abstract the Padding and LayoutOptions for this layout to an application-level ResourceDictionary.
I've tried simplifying this down to a very simple case where I have the following in my application-level ResourceDictionary:
`<Application.Resources>
<LayoutOptions x:Key="RelativeLayout_HorizontalOptions"
Alignment="End"
Expands="True" />
<LayoutOptions x:Key="RelativeLayout_VerticalOptions"
Alignment="Start"
Expands="False" />
</ResourceDictionary>
</Application.Resources>`
And I have the following markup in my RelativeLayout:
<RelativeLayout Padding="50" BackgroundColor="Red" HorizontalOptions="{StaticResource RelativeLayout_HorizontalOptions}" VerticalOptions="{StaticResource RelativeLayout_VerticalOptions}">
<Label Text="Test Label" />
</RelativeLayout>
When the layout is a RelativeLayout the padding is not obeyed at all, but the Alignment for the LayoutOptions is obeyed, while the Expands Boolean is not obeyed. I originally thought this may be because of an inability to parse a String to a Boolean, but this is not the case, as far as I can tell, since the example here shows LayoutOptions done in exactly this way, and the Boolean structure documentation clearly states that the String representation of a Boolean is either "True" or "False", in order for it to be parse-able.
Switching the RelativeLayout to a StackLayout causes the Padding StaticResource definition to be obeyed, but, just as in the case of RelativeLayout, the StackLayout only obeys the Alignment property of the LayoutOptions StaticResource and not the Expands property.
Please look into this bug, since it is at such a fundamental level.