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 Kathy,
Sure!
Basically, you just need to override this method on your implementation of your IGGridViewDelegate:
public class GriDelegate : IGGridViewDelegate { public override UIView ResolveSectionColumnView (IGGridView gridView, int section) { UIView v = new UIView (new RectangleF (0, 0, 0, 100)); v.BackgroundColor = (section%2==0)? UIColor.Red : UIColor.Green; return v; } }
You'll then just return the view you want to display, based on the section. One thing that you have to specify, is the height of the view. In the above example, the height i'm specifying is 100pts.
And here is the code to setup the grid:
grid.Delegate = new GriDelegate (); IGGridViewDataSourceHelper dsh = new IGGridViewDataSourceHelper (); dsh.GroupingKey = "firstName"; dsh.Data = IGSalesmanItem.GenerateData (100).ToArray (); grid.DataSource = dsh;
Hope this helps!
-SteveZ
Hi Steve,
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.
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.
thank you
Hi Mark,
You should just need to do this:
public class MyDelegate : UIScrollViewDelegate, IIGGridViewDelegate { [Export ("gridView:viewForSectionColumn:")] public MonoTouch.UIKit.UIView ResolveSectionColumnView (Infragistics.IGGridView gridView, int section) { return new UIView (); } }
Hope this helps,
My delegate is based not on IGGridViewDelegate but instead like the following
public class MyDelegate : UIScrollViewDelegate, IIGGridViewDelegate
{ ....}
How do I override ResolveSectionColumnView in this case?
Mark
I actually made the column width 0 and that works.
Thanks.