I am wondering how do I change position of popup from toolkit. I expect something like this:
I am trying something like this:
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:popups="clr-namespace:xxx"
x:Class="xxx.SelectPopup"
HorizontalOptions="Center"
VerticalOptions="Start"
>
<VerticalStackLayout>
<Label Text="This is a very important message!" />
</VerticalStackLayout>
</toolkit:Popup>
But I've noticed I can change only HorizontalOptions and VerticalOptions, but I can't change AbsoluteLayout or Anchor (more custom way). How can I achive something like from screen?
Also I am trying with AbsoluteLayout.LayoutBounds="100, 200, 20, 20"
in <toolkit:Popup
but nothing happened.
I use .NET 8.0, MAUI 8.0.40
There's no API to set the absolute position of the Popup. You may raise a feature request on GitHub for that.
According to your scenario, you may try using Anchor
property of Popup, e.g. when click the Button,
private void Button_Clicked(object sender, EventArgs e)
{
var popup = new MyPopup();
//set the Anchor to the Button,
popup.Anchor = sender as Button;
this.ShowPopup(popup);
}
this will set the Popup close to the Button control.
Or you may trying creating your own custom control instead of Popup view. Then you could set the custom control using the absolute position.