Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Resizing Columns to Fill Grid OR Scrolling?
posted

I have a Grid which is used for many different sets of data. Sometimes there's only a few columns other times there are many.

I won't the columns to resize to their content AND fill the Grid IF they don't already fill the Grid.

So if the content is large enough that the Columns are wider than the Grid I want a scroll bar but if not I want them to be resized.

I know how to resize them based on content with PerformAutoResize and how to use AutoFitStyle.ResizeAllColumns but not how to use both together. So when the columns stretch wider than the Grid they end up being compressed to fit to the Grid when I want them to stay how they are.

Any ideas? Is there a way to check if the columns are wider than the grid after the autoresize so that I can set AutoFitStyle.None in that case?