Hi, I have 3 stacked grids setup in a Grid, I put a height request on the first 2 but they are being ignored, the height of all 3 grids is always the same amount and causes the page to scroll. What am I missing?
<Grid x:Name="Grids" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<!-- 25% Height -->
<RowDefinition Height="auto"/>
<!-- 25% Height -->
<RowDefinition Height="*"/>
<!-- 50% Height -->
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Frame BorderColor="Black" Padding="1" Margin="0" CornerRadius="0">
<local:CKNGrid x:Name="gridHeader1" Background="#F3F3F3" ColumnWidthMode="LastColumnFill" HorizontalOptions="FillAndExpand" GridLinesVisibility="Both" AllowEditing="True" EditTapAction="OnTap" HeaderGridLinesVisibility="Both" SelectionMode="None" HeightRequest="50" />
</Frame>
</Grid>
<Grid Grid.Row="1">
<Frame BorderColor="Black" Padding="1" CornerRadius="0">
<local:CKNGrid x:Name="gridHeader2" Background="#F3F3F3" ColumnWidthMode="LastColumnFill" HorizontalOptions="FillAndExpand" GridLinesVisibility="Both" AllowEditing="True" EditTapAction="OnTap" HeaderGridLinesVisibility="Both" SelectionMode="None" HeightRequest="50" />
</Frame>
</Grid>
<Grid Grid.Row="2">
<Frame BorderColor="Black" Padding="1" CornerRadius="0">
<local:CKNGrid x:Name="gridData" Background="#F3F3F3" ColumnWidthMode="LastColumnFill" HorizontalOptions="FillAndExpand" FrozenColumnCount="1" GridLinesVisibility="Both" AllowEditing="True" EditTapAction="OnTap" HeaderGridLinesVisibility="Both" SelectionMode="None" />
</Frame>
</Grid>
</Grid>
Hi Phunction,
In the context of the DataGrid implementation, when confronted with infinite height or width, it presently defaults to 300 in height (MinimumHeightRequest) or width (MinimumWidthRequest). Despite your specified HeightRequest being set to 50, the DataGrid interprets infinite height as 300.
To align with your specific requirements, we recommend setting the MinimumHeightRequest to 50 or your desired value when dealing with infinite height. This ensures that the height conforms to your expectations. For further clarification, please review the provided code snippet below:
|
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:MauiApp1" xmlns:dataGrid="clr-namespace:Syncfusion.Maui.DataGrid;assembly=Syncfusion.Maui.DataGrid" x:Class="MauiApp1.MainPage">
<ContentPage.BindingContext> <local:OrderInfoRepository x:Name="viewModel"/> </ContentPage.BindingContext>
<Grid x:Name="Grids" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions>
<Grid Grid.Row="0"> <dataGrid:SfDataGrid x:Name="dataGrid1" HeightRequest="50" MinimumHeightRequest="50" ItemsSource="{Binding OrderInfoCollection}"> </dataGrid:SfDataGrid> </Grid> <Grid Grid.Row="1"> <dataGrid:SfDataGrid x:Name="dataGrid2" HeightRequest="50" MinimumHeightRequest="50" ItemsSource="{Binding OrderInfoCollection}">
</dataGrid:SfDataGrid> </Grid> <Grid Grid.Row="2"> <dataGrid:SfDataGrid x:Name="dataGrid3" HeightRequest="50" MinimumHeightRequest="50" ItemsSource="{Binding OrderInfoCollection}"> </dataGrid:SfDataGrid> </Grid> </Grid> </ContentPage>
|
Regards,
Tamilarasan