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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to resize columns on adding new row?

Thread ID:

Created:

Updated:

Platform:

Replies:

143092 Mar 4,2019 06:57 PM UTC Mar 6,2019 06:39 AM UTC UWP 4
loading
Tags: SfDataGrid
Fabio
Asked On March 4, 2019 06:57 PM UTC

Hi,
how to resize columns on adding new row?

Regards

Jagadeesan Pichaimuthu [Syncfusion]
Replied On 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 


Fabio
Replied On 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


Fabio
Replied On March 5, 2019 11:21 AM UTC

Hi,
I solved by code.

Thanks

Arulraj A [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;