this.AssociatedObject.InternalGrid.QueryCellInfo += InternalGrid_QueryCellInfo;
void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
GridTreeNode node = this.AssociatedObject.InternalGrid.GetNodeAtRowIndex(e.Style.RowIndex);
if (node != null)
{
PersonInfo person = node.Item as PersonInfo;
if (person.MyEyeColor.Equals("Red"))
{
e.Style.Foreground = Brushes.White;
e.Style.Background = Brushes.Red;
e.Style.Font.FontWeight = FontWeights.Bold;
}
else if (person.MyEyeColor.Equals("Blue"))
{
e.Style.Foreground = Brushes.White;
e.Style.Background = Brushes.Blue;
e.Style.Font.FontWeight = FontWeights.Bold;
}
else if (person.MyEyeColor.Equals("Brown"))
{
e.Style.Foreground = Brushes.White;
e.Style.Background = Brushes.Brown;
e.Style.Font.FontWeight = FontWeights.Bold;
}
}
}
|