I tried like below:
Created a new property named verticalOption
:
private LayoutOptions verticalOption; public LayoutOptions VerticalOption { get => verticalOption; set { verticalOption = value; OnPropertyChanged(nameof(VerticalOption)); } }
Then set its value initially as FillAndExpand
:
VerticalOption = LayoutOptions.FillAndExpand;
At one point I need its value as CenterAndExpand.
VerticalOption = LayoutOptions.CenterAndExpand;
Finally on XAML:
<StackLayout Orientation="Vertical" HorizontalOptions="CenterAndExpand" VerticalOptions="{Binding VerticalOptio}">
But the CenterAndExpand
value is not working. Always stack layout is on the top section, not coming to the center position. Is anything wrong with my implementation?