Skip to content

Instantly share code, notes, and snippets.

@jsuarezruiz
Created July 1, 2020 08:06
Show Gist options
  • Save jsuarezruiz/9dee001a91209f26006e5f5da795b57e to your computer and use it in GitHub Desktop.
Save jsuarezruiz/9dee001a91209f26006e5f5da795b57e to your computer and use it in GitHub Desktop.
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="LRTStyle" TargetType="Label">
<Setter Property="AbsoluteLayout.LayoutBounds" Value="0, 0, 100, 100" />
</Style>
<Style x:Key="RTLTStyle" TargetType="Label">
<Setter Property="AbsoluteLayout.LayoutBounds" Value="0, 1, 100, 100" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<AbsoluteLayout>
<Label
Text="Test Rectangle"
AbsoluteLayout.LayoutFlags="PositionProportional"
Style="{StaticResource LRTStyle}">
<Label.Triggers>
<Trigger TargetType="Label"
Property="FlowDirection"
Value="RightToLeft">
<Setter Property="Style" Value="{StaticResource RTLTStyle}" />
</Trigger>
</Label.Triggers>
</Label>
</AbsoluteLayout>
@npagare
Copy link

npagare commented Jul 2, 2020

Hi @jsuarezruiz Thank you. But, it won't work.

I need AbsoluteLayout.LayoutFlags="XProportional, YProportional"
That's why my style defined are as
<Rectangle x:Key="myCustomLayoutBounds" HeightRequest="22" WidthRequest="{x:Static AbsoluteLayout.AutoSize}" X="0" Y="0.5" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment