We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set height and width of datagrid

Sir/Madam,

How to set Height and width of datagrid. We can increase the height of datagrid but I want to decrease the default height.

I want to set dataGrid with specific height and width other than the default height width.

How to fix GridTableSummaryRow to the bottom of the datagrid.

Thanking you.


5 Replies

SV Suja Venkatesan Syncfusion Team November 22, 2022 02:26 PM UTC

Hi Amish,


Regarding “Fix GridTableSummaryRow to the bottom of the datagrid


You can achieve your requirement by defining Position property of GridTableSummaryRow with value as Bottom . Please refer to our user guidelines documentation regarding Positioning TableSummaryRows in the below link.


UG link: https://help.syncfusion.com/xamarin/datagrid/summary#positioning-tablesummaryrows


Regarding “Set dataGrid with specific height and width other than the default height width


We would like to let you know that by default the MinimumHeightRequest and MinimumWidthRequest of SfDataGrid is 300. So that only SfDataGrid renderer with default height and width value when we set HeightRequest or WidthRequest less than minimum value.

You can achieve your requirement by setting value to MinimumHeightRequest and MinimumWidthRequest based on your requirement. Please let us know if you need any further assistance.


Regards,

Suja



AM Amish replied to Suja Venkatesan November 22, 2022 04:53 PM UTC

Regarding “Set dataGrid with specific height and width other than the default height width

My coding is a below and output image is attached in 1.png file.

<SfGrid:SfDataGrid x:Name="dataGrid" ColumnSizer="Star" HeaderRowHeight="25"

                                       AllowEditing="false" AllowKeyboardNavigation="True" AllowSorting="True" AllowDraggingColumn="True"

                                       IsEnabled="True" SelectionMode="Single" NavigationMode="Cell" EditTapAction="OnDoubleTap" EditorSelectionBehavior="SelectAll"

                                       RowHeight="25" ImeOptions="Done" MinimumWidthRequest="500" MinimumHeightRequest="50" >


Regarding “Fix GridTableSummaryRow to the bottom of the datagrid

I want to first height and width of the grid as per requirement and then set the tablesummary row at the bottom of the grid as shown in attached file 2.png.




Attachment: 1_167d7a0f.zip


SV Suja Venkatesan Syncfusion Team November 23, 2022 03:17 PM UTC

Regarding “Set dataGrid with specific height and width other than the default height width


You can resolve the reported scenario by defining the LayoutOptions to SfDataGrid accordingly, when the SfDataGrid doesn’t obtain finite size from its parent to layout in the View as below code snippet.


<sfgrid:SfDataGrid x:Name="dataGrid"

                               GridStyle="{StaticResource customstyle}"

                               ColumnSizer="Star"

                               HeaderRowHeight="25"

                               AllowEditing="false"

                               AllowKeyboardNavigation="True"

                               AllowSorting="True"

                               AllowDraggingColumn="True"

                               IsEnabled="True"

                               SelectionMode="Single"

                               NavigationMode="Cell"

                               EditTapAction="OnDoubleTap"

                               EditorSelectionBehavior="SelectAll"

                               RowHeight="25"

                               ImeOptions="Done"

                               HeightRequest="100"

                               VerticalOptions="StartAndExpand"

                               HorizontalOptions="StartAndExpand"

                               WidthRequest="500"

                               MinimumHeightRequest="0"

                               ItemsSource="{Binding OrdersInfo}">


Please to our user guidelines documentation regarding the Loading the SfDataGrid with customized height and width in the below link.

UG link: https://help.syncfusion.com/xamarin/datagrid/getting-started#loading-the-sfdatagrid-with-customized-height-and-width


Regarding “Fix GridTableSummaryRow to the bottom of the datagrid


By default, GridTableSummaryRow renderer in the bottom of SfDataGrid when it define the with Position property with value as Bottom. We have attached a simple sample based on your requirement and attached here for your reference. You can customize the sample as per your wish. Please let us know if you need any further assistance.


Attachment: DataGridXamarin_d1ad0fe5.zip


AM Amish replied to Suja Venkatesan January 12, 2023 09:32 AM UTC

Thank you. 


Problem resovled.





SY Suthi Yuvaraj Syncfusion Team January 13, 2023 05:12 AM UTC

We are glad to know that your problem has been resolved. Please let us know if you need any other assistance. We will be happy to assist you.


Loader.
Live Chat Icon For mobile
Up arrow icon