Popup sizing according to datagrid size

I would like to implement a datagrid inside sfpopup. There should be a maximum height and width for datagrid. The column width of datagrid will be changed dynamically based on the data. There should be maximum width for the column width. The popup size will depend on the datagrid size. It will contain the full datagrid on it. Can we achieve this? Also, this popup position will be in the bottom of the button.


2 Replies 1 reply marked as answer

SY Suthi Yuvaraj Syncfusion Team April 15, 2024 02:26 PM UTC

Hi CricVirus,

We have checked your requirements, you can customize the Popup width and height by setting the AutoSizeMode , We have attached the sample for your reference. Please have a look at the sample and let us know if you have any concerns.

Code snippet:

<StackLayout>

    <Button Text="Show Popup" Grid.Row="0" x:Name="ShowPopup" Clicked="Button_Clicked"/>

    <syncfusion:SfPopup x:Name="popupLayout" Grid.Row="1" Padding="10"

                        ShowHeader="False"

                        AutoSizeMode="Both">

        <syncfusion:SfPopup.ContentTemplate>

            <DataTemplate>

                <sfDatagrid:SfDataGrid x:Name="dataGrid" ColumnWidthMode="Fill"

                     ItemsSource="{Binding OrdersInfo}"

                      />

            </DataTemplate>

        </syncfusion:SfPopup.ContentTemplate>

    </syncfusion:SfPopup>

</StackLayout>



Also you can customize the position of the popup ,to open the SfPopup in specific X and Y coordinates, use the SfPopup.Show(x-position, y-position) , also you can open the popup relative to the view SfPopup.ShowRelativeToView(View, RelativePosition) , Please refer the below documentation for more reference.

UG Link:https://help.syncfusion.com/maui/popup/popup-positioning?cs-save-lang=1&cs-lang=csharp

Regards,

Suthi Yuvaraj



SY Suthi Yuvaraj Syncfusion Team April 15, 2024 03:05 PM UTC

Cric virus, 

Please find the attachment in this update ,



Attachment: MAUIPopup_e984fddf.zip

Marked as answer
Loader.
Up arrow icon