Ticket T557465
Visible to All Users

GridView best fit columns

created 8 years ago

The System.Windows.Forms.DataGridView control has one desirable feature. If you have, say, 3 columns and set the AutoSizeMode property of the first two columns to "AllCells" and the AutoSizeMode property of the third to "Fill" you get a nice clean look where the first two columns are exactly big enough to display their data and the third column is exactly big enough to fill the rest of the grid row regardless of how wide or narrow the grid is. Using this example:
https://www.devexpress.com/Support/Center/Question/Details/Q277805/autowidth-of-grid-columns
I was able to easily set all the columns so they're big enough to show their data but this leaves blank space after the last column (see attached screenshot) . Is there a way to simulate the behavior of the Windows grid?

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

Hello Robert,

Starting with version 17.1, we introduced the GridView.AutoFillColumn property that allows you to specify the column that will fill the free space. Set your latest column to this property to achieve your goal.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.