Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Rows not visible when DataGrid is inside a StackLayout #176

Closed
Glareascum opened this issue Jun 7, 2023 · 1 comment
Closed

Rows not visible when DataGrid is inside a StackLayout #176

Glareascum opened this issue Jun 7, 2023 · 1 comment

Comments

@Glareascum
Copy link

In my view, I have a normal StackLayout that contains the DataGrid, which I populate dynamically.
Here is the code:

 <ContentPage.Content>
        <StackLayout>
            <dg:DataGrid x:Name="DataGrid" 
                        RowHeight="70" 
                         HeaderHeight="50" 
                         BorderColor="#CCCCCC" 
                         ActiveRowColor="#8899AA"
                         HeaderBackground="#E0E6F8">
                <dg:DataGrid.RowsBackgroundColorPalette>
                    <dg:PaletteCollection>
                        <Color>#F2F2F2</Color>
                        <Color>#FFFFFF</Color>
                    </dg:PaletteCollection>
                </dg:DataGrid.RowsBackgroundColorPalette>
                <dg:DataGrid.RowsTextColorPalette>
                    <dg:PaletteCollection>
                        <Color>Black</Color>
                        <Color>Black</Color>
                    </dg:PaletteCollection>
                </dg:DataGrid.RowsTextColorPalette>
            </dg:DataGrid>
        </StackLayout>
    </ContentPage.Content>

By doing so, only columnheaders are shown, 0 rows. When I remove the Stacklayout, all works good. Is there any motivation behind this? I must have the grid with also other controls inside my view, so I need a StackLayout to organize them all.

Thanks

@akgulebubekir
Copy link
Owner

You should set some HeightRequest to either DataGrid or StackLayout since they don't know their sizes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants