Question

I have a flexgrid (flex component grid), how do i hide a cell.

For ex: 2nd row and 5th column - i need to hide/remove based on some condition.

for say

if(C1FlexGrid1.Rows[2][5].ToString().Length <0)
{
  //I want this to be invisible.
  C1FlexGrid1.Rows[2][5].isVisible=false;
}

There is no propery that supports isVisible the way i have used. Any way i can achieve this ? Thanks.

Was it helpful?

Solution

Finally i figured it out:

Create a ownerdrawcell event for your winforms component grid:

componentGrid.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw;
componentGrid.OwnerDrawCell += componentGrid_OwnerDrawCell;

Method

void componentGrid_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
{
       var value = componentGrid.GetCellCheck(e.Row,e.Col);
       //Your custom condition
       if (value is bool)
       {
          //Will hide the cell
          e.Style.Display = DisplayEnum.None;
       }
       else
       {
           //Will show the cell  
           e.Style.Display = DisplayEnum.Stack;
       }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top