Home Forums WinForms controls Xceed Grid for WinForms How do I resize the grid and columns when the data is modified?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17799 |

    Yes. In order to do so, you will need to subscribe to each of the columns’ editors (by default a GridTextBox) TextChanged event in order to resize when a character is added or removed to or from a cell.

    As for the resizing the grid, you would need to do the following to resize it so that all the columns are displayed:

    int totalColWidth = 0;

    foreach( Xceed.Grid.Column col in gridControl1.Columns )
    {
        totalColWidth = totalColWidth + col.Width;
    }

    gridControl1.Width = totalColWidth + gridControl1.RowSelectorPane.Width + gridControl1.ClientRectangle.Width – gridControl1.DisplayRectangle.Width;

    A that demonstrates the required implementation is available for download (see attachments).

    Imported from legacy forums. Posted by Xceed admin (had 1698 views)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.