How to know the index of one GridViewCell

3 posts, 1 answers
  1. Jackey
    Jackey avatar
    71 posts
    Member since:
    Oct 2014

    Posted 20 Mar 2015 Link to this post

    Hi team,
    I am using CellStyleSelector documented in this link. However, in the following code 
    public override Style SelectStyle(object item, DependencyObject container)
     {
      if (item is Club)
      {
       Club club = item as Club;
       if (club.StadiumCapacity > 50000)
       {
        return BigStadiumStyle;
       }
       else
       {
        return SmallStadiumStyle;
       }
      }
      return null;
     }
    I want to know the column index of the GridViewCell. I know the container object is type of GridViewCell. However i don't know how to continue. I read some class documentation, finding no proper ways. Any ideas?

    Thanks,
    Jingfei
  2. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 Mar 2015 Link to this post

    Hello,

    You could find the column associated with he cell passed as the container argument. The code to access it would be similar to this one:

    GridViewCell cell = container as GridViewCell;
    var currentColumn = cell.Column as GridViewDataColumn;


    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Jackey
    Jackey avatar
    71 posts
    Member since:
    Oct 2014

    Posted 11 Apr 2015 in reply to Dimitrina Link to this post

    Thanks a lot for your assistance, Dimitrina.
Back to Top