답변

0

enter image description here 마지막으로 해결책을 발견, 자신 :)

나는` '윈도우 8 애플리케이션으로 ASP.NET`GridView`을하지하고 있어요 때문에 나에게 적용 할 수 없습니다
public class IndexToColorConverter : IValueConverter 
{ 
    public object Convert(object value, Type targetType, object parameter, string language) 
    { 
     SolidColorBrush _color = null; 
     int _val = (int)value % 9; 
     switch (_val) 
     { 
      case 1: 
      case 3: 
      case 8: 
       _color = App.Current.Resources["GreenBrush"] as SolidColorBrush; 
       break; 

      case 0: 
      case 5: 
      case 7: 
       _color = App.Current.Resources["OrangeBrush"] as SolidColorBrush; 
       break; 

      case 2: 
      case 4: 
      case 6: 
       _color = App.Current.Resources["PurpleBrush"] as SolidColorBrush; 
       break; 
     } 

     return _color; 
    } 

    public object ConvertBack(object value, Type targetType, object parameter, string language) 
    { 
     throw new NotImplementedException(); 
    } 
} 
0
int i=0; 
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
    if (i == 0) 
    { 
     e.Row.Cells[0].BackColor = System.Drawing.Color.Purple; 
     e.Row.Cells[1].BackColor = System.Drawing.Color.Green; 
     e.Row.Cells[2].BackColor = System.Drawing.Color.Red; 
     i++; 
    } 
    else if (i == 1) 
    { 
     e.Row.Cells[0].BackColor = System.Drawing.Color.Green; 
     e.Row.Cells[1].BackColor = System.Drawing.Color.Red; 
     e.Row.Cells[2].BackColor = System.Drawing.Color.Purple; 
     i++; 
    } 
    else if (i == 2) 
    { 
     e.Row.Cells[0].BackColor = System.Drawing.Color.Red; 
     e.Row.Cells[1].BackColor = System.Drawing.Color.Purple; 
     e.Row.Cells[2].BackColor = System.Drawing.Color.Green; 
     i = 0; 
    } 
} 
+0

GridView'. – Xyroid

관련 문제