Re-enable DataGrid ScrollBar shows incorrect

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.
 
G

Gregory Persson

// 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top