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
close icon

column width auto resize

I am using  ColumnSizer="Auto" .
 
Is there a way to get the column to resize as  you edit a cell?
 
For example,  if the cell width  shows only 3 digits  and you enter in more digits, the column width will resize to show the entire cell value as you type in digits.
 
 
Thanks,
Mary

1 Reply

RS Ravi Shankar B Syncfusion Team November 28, 2012 10:27 AM UTC

Hi Mary,

 

We have analyzed your query and you can achieve it by handling CommittedCellInfo event and invoke the ResizeColumnToFit method and pass the column and GridResizeToFitOption as parameter as follows.

 public ViewWindow()

        {

            InitializeComponent();

            this.syncgrid.Model.CommittedCellInfo += new GridCommitCellInfoEventHandler(Model_CommittedCellInfo);

        }

 

        void Model_CommittedCellInfo(object sender, GridCommitCellInfoEventArgs e)

        {

            this.Dispatcher.BeginInvoke(new Action(() =>

            {

                this.syncgrid.Model.ResizeColumnsToFit(GridRangeInfo.Col(e.Cell.ColumnIndex), GridResizeToFitOptions.None);

            }));

        }

 

 

We have created a simple sample and you can download this from following link.

http://www.syncfusion.com/downloads/Support/DirectTrac/101303/Resize_demo1166533330.zip

 

Regards,

Ravi Shankar B.


Loader.
Live Chat Icon For mobile
Up arrow icon