I'm trying to reposition some text labels by changing the horizontal and vertical options in a viewmodel, however, when i update the horizontal and vertical options my label moves to the top left corner instead of the correct position, when i update the text in the label the correct position will be set. is it possible to instantly set the correct new position instead of the label moving to the top left corner first?
` the goal is to reposition the label inside of the frame by selecting a new position from a picker
<Frame Grid.Row="0"
Grid.Column="0"
BorderColor="Black"
Margin="10">
<Label Text="{Binding PreviewCellText}"
HorizontalOptions="{Binding HorizontalOption}"
VerticalOptions="{Binding VerticalOption}"
>
</Label>
</Frame>
`
Horizontal and vertical property's in viewmodel:
` private LayoutOptions horizontalOption;
public LayoutOptions HorizontalOption
{
get => horizontalOption;
set
{
horizontalOption = value;
OnPropertyChanged(nameof(HorizontalOption));
}
}
private LayoutOptions verticalOption;
public LayoutOptions VerticalOption
{
get => verticalOption;
set
{
verticalOption = value;
OnPropertyChanged(nameof(VerticalOption));
}
}
`
picker property
` private string selectedPosition;
public string SelectedPosition
{
get => selectedPosition;
set
{
selectedPosition = value;
UpdateLocation(value);
}
}
`
` UpdateLocation method:
private void UpdateLocation(string selectedPosition)
{
Debug.WriteLine("Can update location: " + selectedPosition);
switch (selectedPosition)
{
case "Gecentreerd":
HorizontalOption = LayoutOptions.Center;
VerticalOption = LayoutOptions.Center;
break;
...
}
}
`
aparently i cant upload any images to show what i want to achieve...