Re-enable DataGrid ScrollBar shows incorrect

  • Thread starter Thread starter Klaus Bronn
  • Start date Start date
K

Klaus Bronn

I have a datagrid with several columns exceeding the viewport of the grid.
If I first disable the grid (DataGrid.Enabled=False) and then later
re-enable it, the horizontal scrollbar shows but
looks like there is nothing to scroll.

Any solutions / workarounds for this problem?

Please help.
 
// Back up DataGrid.Enabled state
bool enabled = grid.Enabled;
grid.Enabled = true; // Grid has to be Enabled when setting new Tables,
otherwise ScrollBars won't activate.

// Bind to the DataGrid
grid.SetDataBinding( dataSet, tableName );

// Restore DataGrid enabled state
grid.Enabled = enabled;

It took me a long time to discover what was going on with the scrollbars
when I encountered it.
If there are any other ways to deal with it, I'd like to know as well.

~Greg Persson
 
Back
Top