I am wandering if its possible to add multiple AbsoluteLayoutFlags to a child? when doing it in c#?
I know that it is possible in XAML:
StackLayout BackgroundColor="White"
Orientation="Horizontal"
HorizontalOptions="FillAndExpand"
AbsoluteLayout.LayoutBounds="0, 0, 1, 90"
AbsoluteLayout.LayoutFlags="PositionProportional, WidthProportional">
But when I try to do this from c# I am apparently only able to add one:
layout.Children.Add(topMenu(), new Rectangle(0, 0, 1, 90), AbsoluteLayoutFlags.PositionProportional);
Hope to get help with this and thanks in advance :-)
Just add OR operator between Flags
layout.Children.Add(topMenu, new Rectangle(0, 0, 1, 90), AbsoluteLayoutFlags.PositionProportional|AbsoluteLayoutFlags.SizeProportional|AbsoluteLayoutFlags.SizeProportional);
You can append |
operator how any values available for AbsoluteLayoutFlags
enum
. Or you can try below one
You can add AbsoluteLayoutFlags
to any control individually how many you need. Have a look on this sample code snippets
var layout = new AbsoluteLayout
{
BackgroundColor = Color.Blue.WithLuminosity(0.9),
VerticalOptions = LayoutOptions.FillAndExpand
};
var topMenu = new Label
{
Text = "Left",
TextColor = Color.Black
};
AbsoluteLayout.SetLayoutFlags(topMenu,
AbsoluteLayoutFlags.None|AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(topMenu,
new Rectangle(0, 0, 1, 90));
layout.Children.Add(topMenu);