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 resize columns on adding new row?

Hi,
how to resize columns on adding new row?

Regards

4 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team March 5, 2019 09:46 AM UTC

Hi Fabio, 
 
Thanks for using Syncfusion product. 
 
Your requirement to adjust the size of the columns based on the newly added rows can be achieved by setting ColumnSizer property to SizeToCells that calculates the width of column based on cell contents.  
 
Please refer the following UG documentation. 
 
 
If we misunderstood your requirement, please provide more information regarding your requirement. It would be more helpful to proceed further and resolve this issues as earliest. 
 
Regards, 
Jagadeesan 



FA Fabio March 5, 2019 10:15 AM UTC

Hi,
I did it, but not work.
I load data in asynchronyus mode and after to have loaded the datagrid.

This is the xaml:

        <sync:SfDataGrid x:Name="datagrid"
                         Grid.Row="1"
                         ItemsSource="{x:Bind Main.Movimenti}"
                         SelectedItem="{x:Bind Main.SelectedItem,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                         DoubleTapped="{x:Bind Main.Modifica}"
                         AllowDraggingColumns="True"
                         AllowFiltering="True"
                         AllowResizingColumns="True"
                         AllowTriStateSorting="True"
                         AutoGenerateColumns="False"
                         attached:sfDataGridAttachedProperties.AutomaticallyRowsHeight="True"
                         attached:sfDataGridAttachedProperties.IsIncrementalLoading="True"
                         FontSize="14"
                         LiveDataUpdateMode="AllowDataShaping"
                         AllowRowHoverHighlighting="True"
                         ShowRowHeader="True"
                         AllowSorting="False"
                         ColumnSizer="SizeToCells">
            <sync:SfDataGrid.Columns>
                <sync:GridCheckBoxColumn HeaderText="Pagata"
                                         MappingName="IsPagata"/>
                <sync:GridTextColumn HeaderText="Numero"
                                     MappingName="NumeroDocumento"/>
                <sync:GridDateTimeColumn HeaderText="Data"
                                         MappingName="DataDocumento"
                                         FormatString="dd/MM/yyyy"/>
                <sync:GridTextColumn HeaderText="Nominativo"
                                     MappingName="Nominativo"/>
                <sync:GridTextColumn HeaderText="Categoria"
                                     MappingName="Categoria" />
                <sync:GridTextColumn HeaderText="SubCategoria"
                                     MappingName="SubCategoria" />
                <sync:GridTextColumn HeaderText="Descrizione"
                                     MappingName="Descrizione"/>
                <sync:GridNumericColumn HeaderText="Importo"
                                        MappingName="Importo"
                                        ParsingMode="Decimal"
                                        FormatString="€ #,##0.00" />
                <sync:GridDateTimeColumn HeaderText="Scadenza"
                                         ValueBinding="{Binding Converter={StaticResource ToNullConverter},Path=Scadenza}"/>
                <sync:GridTextColumn HeaderText="Destinatario"
                                         MappingName="Destinatario" />
            </sync:SfDataGrid.Columns>
        </sync:SfDataGrid>


Regards



FA Fabio March 5, 2019 11:21 AM UTC

Hi,
I solved by code.

Thanks


AA Arulraj A Syncfusion Team March 6, 2019 06:39 AM UTC

Hi Fabio,

Thanks for the update.

Please feel free to contact us in case of any further difficulty. We'll be glad to assist you.

Regards,
Arulraj A

Loader.
Live Chat Icon For mobile
Up arrow icon