Ticket T259382
Visible to All Users

Grid - How to Best Fit all columns

created 10 years ago

[DevExpress Support Team: CLONED FROM T259228: Grid and contextual menu]
Please refer to attachment.

  1. How do I make all the columns in my grid to 'Best Fit (all columns)'? Some of the grid is using BindingList<T> while others are using DataTable as binding source.

Answers approved by DevExpress Support

created 10 years ago

Hello,
You can use the GridView.BestFitColumns method to perform the corresponding action.
Please test it and let me know if it is what you are looking for.

    Comments (2)

      Do you mean I can set it once and it will auto adjust?
      Does this work for LookupEdit or GridLookUpEdit?

      DevExpress Support Team 10 years ago

        No, this method resizes columns only once, when you call it.
        For the LookUpEdit control, you can use the RepositoryItemLookUpEdit.BestFit method. The GridLookUpEdit control contains GridControl within the popup, so you can use the same methods as for a standalone grid.
        I hope you find this information useful.

        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.