This project is read-only.

Highlight Rows

Jul 27, 2009 at 2:30 PM

How do i highlight a row. I'm using the extended datagrid and  is unable to use datagrid1[0,0]. <- [0,0]

Thanks!

 

Jul 27, 2009 at 3:20 PM
Just do grid.Selection.SelectRow(rownum.true)
Jul 27, 2009 at 3:31 PM

Solution: I added a condition to each column

private

{

SourceGrid.Cells.Views.

viewSelected.ForeColor =

viewSelected.TextAlignment = align;

viewSelected.BackColor = color;

 

static SourceGrid.Conditions.ConditionView HighlightRow(Color color,int status,DevAge.Drawing.ContentAlignment align)Cell viewSelected = new SourceGrid.Cells.Views.Cell();Color.White;//Create selected conditions

SourceGrid.Conditions.

selectedConditionBold.EvaluateFunction =

{

 

 

{

 

ConditionView selectedConditionBold = new SourceGrid.Conditions.ConditionView(viewSelected);delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)DataRowView row = (DataRowView)itemRow;if (row != null)try

{

 

 

 

if (Convert.ToInt32(row["p"]) == status)return true;else

{

 

}

}

 

return false;catch

{

 

}

}

 

};

 

}

return false;return false;return selectedConditionBold;

Jul 27, 2009 at 3:33 PM

Heres a other copy

private static SourceGrid.Conditions.ConditionView HighlightRow(Color color,int status,DevAge.Drawing.ContentAlignment align)
  {
   SourceGrid.Cells.Views.Cell viewSelected = new SourceGrid.Cells.Views.Cell();
   viewSelected.ForeColor = Color.White;
   viewSelected.TextAlignment = align;
   viewSelected.BackColor = color;
   //Create selected conditions
   SourceGrid.Conditions.ConditionView selectedConditionBold = new SourceGrid.Conditions.ConditionView(viewSelected);
   selectedConditionBold.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
   {
    DataRowView row = (DataRowView)itemRow;
    if (row != null)
    {
     try
     {
      if (Convert.ToInt32(row["p"]) == status)
       return true;
      else
      {
       return false;
      }
     }
     catch
     {
      return false;
     }
    }
    return false;
   };
   return selectedConditionBold;
  }

Jul 27, 2009 at 4:41 PM
That seems a bit overkill. there is one of the examples that shows you how to change the "selected colour", unselected colour, borders etc.  basically that does it all.  you can then say if you want row select or cell select and you are done.
 
Derek