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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

StDataGrid GridColumnSizer.Refresh

Thread ID:

Created:

Updated:

Platform:

Replies:

150324 Jan 2,2020 08:09 AM UTC Jan 3,2020 01:24 PM UTC Xamarin.Forms 1
loading
Tags: SfDataGrid
Bobby
Asked On January 2, 2020 08:09 AM UTC

I have a columns that are GridTemplate columns with Custom Controls and Xamarin Forms Controls (Entry, etc.). If  I change the value of the Entry object, I fire an event and my SfDataGrid subscribces to this event change and attempts to Refresh the columns but fails. The columns do not resize.
The entry object itself seems like it is the same size.  I'm not sure if the Entry object itself has to resize and that in turn can trigger the column resizing.


My table column:
  GridTemplateColumn tableColumn = new GridTemplateColumn()
                        {
                            HeaderText = tableColumnDefinition.Header,
                            MappingName = mappingName,
                            LineBreakMode = LineBreakMode.WordWrap,
                            TextAlignment = TextAlignment.Center,
                            HeaderTextAlignment = TextAlignment.Center,
                            ColumnSizer = ColumnSizer.Auto
                        };

Karthikraja Kalaimani [Syncfusion]
Replied On January 3, 2020 01:24 PM UTC

Hi Bobby,

Thanks for contacting Syncfusion support.

Your requirement can be achieved by refreshing the columns instead of refreshing the SfDataGrid on Value changed event of the Entry in GridTemplateColumn. We have prepared sample for the same.

Please refer the below code example,

 
[XAML]
…..
<syncfusion:GridTemplateColumn.CellTemplate> 
    <DataTemplate> 
                        <Grid>
<
Entry Text="{Binding Name}" TextChanged="Entry_TextChanged"></Entry> 
                        </Grid> 
                    </DataTemplate> 
 </syncfusion:GridTemplateColumn.CellTemplate>
…..

[.CS]
…..
private
void Entry_TextChanged(object sender, TextChangedEventArgs e) 
        { 
            if (e.OldTextValue != null && e.NewTextValue != null && e.NewTextValue != e.OldTextValue) 
            { 
//here grid.Columns[0] is the entry(Template column) column of SfDataGrid 
                grid.GridColumnSizer.ResetAutoWidth(grid.Columns[0]); 
                grid.GridColumnSizer.Refresh(); 
            } 
        }
…. 



Video link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/Video_150324754275601.zip


We hope this helps, please let us know if need further assistance from us.

Regards,
Karthik Raja


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

Live Chat Icon For mobile
Live Chat Icon