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.
Unfortunately, activation email could not send to your email. Please try again.

column width auto resize

Thread ID:

Created:

Updated:

Platform:

Replies:

105693 Nov 13,2012 10:57 AM Nov 28,2012 05:27 AM WPF 1
loading
Tags: GridControl
Mary Fontana
Asked On November 13, 2012 10:57 AM

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

Ravi Shankar B [Syncfusion]
Replied On November 28, 2012 05:27 AM

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.


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.

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.

;