c# - Best way to remember DataGridView settings when rebinding DataSource -
i have read dgv on tab of application. let users sort column , reorder columns , select row. in part of application can edit data in dgv when go tab dgv i'd refresh data keep user's settings such column order, sort order, , row selection. right i'm setting dgv new list of items , resets of these settings. there anyway persist these after rebind data?
thanks,
cody
store user's settings in internal object. wrap binding logic in suspendlayout() , resumelayout() calls, can apply settings dgv before the visuals redrawn.
// pseudo code private void refreshdgv() { saveusersettings(); mydgv.suspendlayout(); mydgv.datasource = mydatasource; applyusersettings(); mydgv.resumelayout(); }
Comments
Post a Comment