Hi,
I'm looking for an example to the implementation of viewForSectionColumn but in C#. The examples and documentation are all in objective C.
I'm using a datasource helper.
Thanks
Kathy
Hi Steve
col 0 is NOT the column I'm grouping on. I'm using the grouping to make a section header. I did use the fieldsToIgnore, but the dsh seems to not recognize that, I guess because I am adding col0. ( dsh.ColumnDefinitions.Add(col0);) If I don't add column0 it doesn't resolve.
Hi Kathy,
To be clear, is Column 0 the column you're grouping on?
If so, then to have the column not auto generated, you can do the following:
grid.Delegate = new GriDelegate (); IGGridViewDataSourceHelper dsh = new IGGridViewDataSourceHelper (); dsh.GroupingKey = "firstName"; dsh.FieldsToIgnore.Add (new NSString("firstName")); // <-- do not auto generate this column. dsh.Data = IGSalesmanItem.GenerateData (100).ToArray (); grid.DataSource = dsh;
-SteveZ
Hi Steve,
Again, thanks it way very helpful. What I did was use the value from column 0 in an NSObject as you described and the section column reflects that value--great!
But now column0 shows up again in the regular part of the grid. So the value is in the Section column and in the 1st column of the moving section.
I guess I see why that is happening, but I thought the column0 would be the section column. Do you have any suggestions for this?
First, let me show you how you would resolve the section values for that grouping:
public override UIView ResolveSectionColumnView (IGGridView gridView, int section) { IGGridViewDataSourceHelper dsh = (IGGridViewDataSourceHelper)gridView.DataSource; NSString key = (NSString)dsh.Sections [section]; UITextView v = new UITextView (new RectangleF (0, 0, 0, 100)); v.Text = key; v.BackgroundColor = (section%2==0)? UIColor.Red : UIColor.Green; return v; }
This would show you the value that the particular section is grouped on.
Now, if you wanted to display one of the values in the row, you could look up the value via the path:
NSObject obj = dsh.ResolveDataValueForCell(new IGCellPath(0,section,0));
The code above will give you the value for the First Row, in the First Column, of that particular section.
That did help and thanks for answering so quickly. One other question, how do I get the data that's in column 0 connected to the columnView? right now what shows is the background color.