I need to use a custom class which returns a generic.list object. I can make it the datasource and get it to display great. I would like to manipulate the columns (add, hide, etc) at runtime. I seem to either be putting the wrong keywords in the search or something. FYI, I am a nubee to Infragistics toolset.
Also I am using the UltraGrid component. Sorry.
Hi, btesch
I think that persons from Infragistics support will provide you with the best advices and samples, but I would try to propose my tips. I usually use an UltraDataSource which can represent an intermediate level between your own datasource like generic lists or any others data storages and GUI control like ultra grid.
Your ultra grid must be linked to UltraDataSource like this:
grid.DataSource = ultraDataSource; // where ultraDataSource is an instance of Infragistics.Win.UltraWinDataSource.UltraDataSource class.
Since we use ultradatasource we can delete, add columns.
For adding columns at runtime use the next code snippet:
dataSource.Band.Columns.Add(string column)
Note that an constructor contains also the signature with type of column.
To delete column:
dataSource.Band.Columns.Remove or dataSource.Band.Columns.RemoveAt.
To temporary hide column on UI you should do the following action on ultra grid column:
grid.DisplayLayout.Bands[0].Columns["YourColumnKey"].Hidden = true;
Since setting that property a column will be hidden until doing an opposite actions that is setting hide to false:
grid.DisplayLayout.Bands[0].Columns["YourColumnKey"].Hidden = false;
Thanks, Alex.