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 Autosizing (functionality and a possible bug)

Thread ID:

Created:

Updated:

Platform:

Replies:

84826 Jul 2,2009 04:45 PM Jul 3,2009 09:24 AM WPF 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 2, 2009 04:45 PM

I am using version 7.2.0.20 of the WPF Grid. I have been requested to add some functionality to our grids. Also, a possible bug has been found.

1. Have the ability to double-click on the column resizer to get the corresponding column to automatically size to the optimum width. Is there a flag I can set or an event I can attach to accomplish this?

2. The users are complaining that the default autosizing for the columns allows for too much padding. What properties can I work with to get the padding minimized? They want the column widths to be completely "snug" with the data and no extra space should be to either side of the widest data in the column.

Bug: When manually resizing a column the users sometimes find that the column does not stop resizing after the mouse button is lifted. The column will continue to resize until the mouse button is clicked somewhere in the grid again.

Thank you.

Administrator [Syncfusion]
Replied On July 2, 2009 04:52 PM

Oh, I forgot to mention previously that I am using the GridControl control not the newer GridDataControl control.

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On July 3, 2009 09:24 AM

Hi David,

Thanks for the details.

1) You could listen to the ResizingColumns event to cancel the default resizing and auto-size it through a method call,

void grid_ResizingColumns(object sender, Syncfusion.Windows.Controls.Grid.GridResizingColumnsEventArgs args)
{
if (args.Reason == Syncfusion.Windows.Controls.Grid.GridResizeCellsReason.DoubleClick)
{
args.AllowResize = false;
this.grid.Model.ResizeColumnsToFit(args.Columns, GridResizeToFitOptions.None);
}
}

The ResizeColumnsToFit would do calculate the optimal width and adjust the width.

2) There is a small padding of value 2 is added to each cell by default, this is because when you go into the edit mode the TextBox will occupy an extra space when it comes into focus. And when the text is drawn it doesn't include this padding values. Can you please send me a screenshot of the padding that you are mentioning here.

3) I do not see this issue with the older or the latest version, I would like to have a reproducing sample or video. This would be of great help in quickly identifying the issue.

We also have fixed up some major internal issues, So you may want to try out the Vol3 release when it is out over the coming weeks.

Please let me know if you need any more details.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,

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.

;