No control over what is displayed.

So many problems.  

  1.  Using GridTemplateColumn and some of the template is shown and some not.  I have tried StackLayout/Grid and changed the order of my wanttobe contents in the grid and each time I get something that has no explanation other than it is not really a Template based control.
  2. Lines in the DataGrid are just random both vertical and horizontal.

Here is the XAML I am talking about:

            <datagrid:SfDataGrid.Columns>

                <datagrid:GridTemplateColumn HeaderText="Day" MappingName="whatever" HeaderCellTextSize="18" Width="100" >

                    <datagrid:GridTemplateColumn.CellTemplate>

                        <DataTemplate>

                            <Grid RowDefinitions="*,Auto,*" >

                                <Label Grid.Row="0" Text="July" FontAttributes="Bold" HorizontalTextAlignment="Center"></Label>

                                <Label Grid.Row="2" Text="{Binding Day , StringFormat='{}{0:dd}'}" FontAttributes="Bold" HorizontalTextAlignment="Center"></Label>

                                <Grid Grid.Row="1" ColumnDefinitions="Auto,Auto" BackgroundColor="Red">

                                    <Label Grid.Column="0" Text="Worked"></Label>

                                    <CheckBox Grid.Column="1" IsChecked="{Binding Worked}"></CheckBox>

                                </Grid>

                            </Grid>


                        </DataTemplate>

                    </datagrid:GridTemplateColumn.CellTemplate>

                </datagrid:GridTemplateColumn>

Now if I change the Grid.Row of each to the item a different WRONG display is offered.  The only thing worse is using a StackLayout because I have found that Syncfusion and StackLayout are not in any way compatible.


Seems like the row height (which you have no control over is set by the control and any desire by the developer (and isn't that what 3rd party controls are supposed to do) to change it is not happening.  I noticed that WPF has a fix for both the above so I am confused.


4 Replies

LS Lloyd Sheen July 2, 2022 08:01 PM UTC

Oh and it gets better (not really).

Changed XAML to the following just to see how screwed up this is.

                <datagrid:GridTemplateColumn HeaderText="Day" MappingName="whatever" HeaderCellTextSize="18" Width="100" >

                    <datagrid:GridTemplateColumn.CellTemplate>

                        <DataTemplate>

                            <Grid HeightRequest="500" RowDefinitions="*,*">

                                <Grid Grid.Row="0" BackgroundColor="Red"></Grid>

                                <Grid Grid.Row="1" BackgroundColor="Blue"></Grid>

                            </Grid>

                            <!--<Grid RowDefinitions="Auto,Auto,Auto" >

                                <Label Grid.Row="2" Text="July" FontAttributes="Bold" HorizontalTextAlignment="Center"></Label>

                                <Label Grid.Row="1" Text="{Binding Day , StringFormat='{}{0:dd}'}" FontAttributes="Bold" HorizontalTextAlignment="Center"></Label>

                                <Grid Grid.Row="0" ColumnDefinitions="Auto,Auto" BackgroundColor="Red">

                                    <Label Grid.Column="0" Text="Worked"></Label>

                                    <CheckBox Grid.Column="1" IsChecked="{Binding Worked}"></CheckBox>

                                </Grid>

                            </Grid>-->


                        </DataTemplate>

                    </datagrid:GridTemplateColumn.CellTemplate>

                </datagrid:GridTemplateColumn>

I can set the overall grid heightrequest to any value and it has no effect. 100,200,500.

So you cannot set the height / it does not resize according to content / it is basically useless.



LS Lloyd Sheen July 2, 2022 08:06 PM UTC

Oh and one more.


Oh cannot post it as you don't like (oh can't show you).  Your message about not posting should post the word.




SV Suja Venkatesan Syncfusion Team July 4, 2022 02:30 PM UTC

Hi Lloyd,


Currently, we are validating the reported scenario on our end. We will update you with further details on or before July 6, 2022. We appreciate your patience and understanding.


Regards,

Suja



SV Suja Venkatesan Syncfusion Team July 6, 2022 02:17 PM UTC

Hi Lloyd,


Regarding scenario “Set the overall grid heightrequest to any value and it has no effect

 

You can resolve the scenario by setting SfDataGrid row height based on the content using QueryRowHeight as like below code snippet

 

Code Snippet:

dataGrid.QueryRowHeight += DataGrid_QueryRowHeight;

       

private void DataGrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e)

        {

            // Code to skip querying of a row if already queried

            if (e.Height != dataGrid.RowHeight)

                return;

            if (e.RowIndex != 0)

            {

                //Calculates and sets the height of the row based on its content.

                e.Height = dataGrid.GetRowHeight(e.RowIndex);

                e.Handled = true;

            }

        }

Please refer our user guidelines documentation regarding Auto fit row based on content.

 

UG link: https://help.syncfusion.com/xamarin/datagrid/row-height-customization#auto-fit-the-grid-rows-based-on-content

 

We have attached a sample which we prepared with a provided code snippet with illustration video for your reference.

Regarding  Scenario “Syncfusion and StackLayout are not in any way compatible”

 

and

 

 “change the Grid.Row of each to the item a different WRONG display is offered”

 

We have checked both reported scenarios, we unable to replicate the reported scenario on our end. We didn’t found any issue while using StackLayout with SfDataGrid and item gets displayed properly while changing Grid.Row. Please revert to us with simple sample with illustration video to proceed further on this. Could you please confirm in which platform you are facing the reported scenario?


Regards,

Suja



Attachment: F175999_a5ca4b3b.zip

Loader.
Up arrow icon