Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
460
how to implement section column in C#
posted

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  

Parents
No Data
Reply
  • 40030
    Suggested Answer
    Offline posted

    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


Children