Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set size of Xamarin Community Toolkit Popup to wrap content dynamically in Xamarin Forms?

I have a Xamarin.CommunityToolkit - Popup. I don't want to predefine its size. I want it to size according to the content dynamically. Is there any way to achieve this?

Here is my XAML code:

<?xml version="1.0" encoding="UTF-8"?>
<xct:Popup xmlns="http://xamarin.com/schemas/2014/forms" 
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
           x:Class="SampleProject.Views.SamplePopup">

    <StackLayout>
        <Label Text="Hello Xamarin.Forms!" />
        <Button Text="Close Popup" Clicked="ClosePopup" />
    </StackLayout>
</xct:Popup>
like image 937
Junaid Pathan Avatar asked Sep 16 '25 20:09

Junaid Pathan


1 Answers

The current implementation doesn't support such feature, as Amjad mentioned in his comment there was a similar feature request in the past but it was closed as things were migrating to the new repo .NET MAUI community toolkit.

If you are interested you can open a discussion explaining or pointing to the link of that feature request.

like image 158
Cfun Avatar answered Sep 19 '25 09:09

Cfun