Hi
I'd like to get an example of sorting multiple columns in a grid using C#.
Thanks
Kathy
Hi Kathy,
Sure, np.
I've attached the iGSalesmanItem class, converter to C#.
You just need to make sure you export your properties.
Also, here is a code snippet showing the grid consuming that data with an image column:
IGGridView grid = new IGGridView (this.View.Bounds, IGGridViewStyle.IGGridViewStyleDefault); grid.Theme = new IGGridViewDarkTheme (); grid.RowHeight = 150; grid.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; this.View.AddSubview (grid); IGGridViewImageColumnDefinition col = new IGGridViewImageColumnDefinition ("image", IGGridViewImageColumnDefinitionPropertyType.IGGridViewImageColumnDefinitionPropertyTypeImage); col.TextFieldKey = "firstName"; col.TextAlignment = UITextAlignment.Center; IGGridViewSingleFieldMultiColumnDataSourceHelper dsh = new IGGridViewSingleFieldMultiColumnDataSourceHelper (col); dsh.NumberOfColumns = 5; dsh.Data = IGSalesmanItem.GenerateData (200).ToArray (); grid.DataSource = dsh;
Hope this helps,
-SteveZ
Hi Steve,
I'm trying to use the DataSourceHelper for the IGGrid using C# to take advantage of the built in sorting and filtering
I originally created a custom IGdatasource and passed in a double array and have it working great. My data contains images and text. I'm having trouble figuring out what exactly the DataSource helper wants as a data structure. All of the examples I find in the Infragistics documentation refer to data but do not show how this sample data is actually set up so I don't know what all the references are and how the data (itself) and the DataSourcehelper are actually connected. The datasourcehelper apparently requires an NSArray as imput. All of the examples that I can find seem to be one column examples. Can you just give me an example of how to set up an NSObject that has multiple columns that the DataSourceHelper will accept? For instance in the Nuclios app example on grid sorting which uses the igSalesmanitem to generate data, it would be helpful to see how that data is set up (in C#) to be able to populate my grid with the DataSourceHelper
Thanks very much. I have a little time right now to try changing way I have and it may work out in the long run so I can implement filtering and sorting.
Hey Kathy,
The DataSourceHelpers are basically what they sound like. They're just helper classes that implement the IGGridViewDataSource protocol. Or in the MonoTouch world, they derive from the IGGridViewDataSource class.
That means that you can do anything with them, that you could do when you implement the DataSource yourself. The benefit is that it does a lot of work for you, so that you don't have to build everything yourself.
i.e. it handles sorting via the SortedColumnDefinitions.
Hi Steve
I don't recall at this point why I chose to not use the DataSourceHelper. Does it have any limitations as compared to overriding the IGGridViewDataSource? I think I was under the impression that the DataSourceHelper was not as customizable, but if that's not the case then perhaps I should try using a DataSourceHelper instead..