private void FillEmpty() { Func <int, bool> IsOdd = x => x % 2 != 0; Tiles = new ObservableCollection <CellVM>(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { CellVM c = new CellVM(i, j); if (IsOdd(i)) { if (IsOdd(j)) { c.Background = Brushes.Transparent; } else { c.Background = Brushes.Black; } } else { if (IsOdd(j)) { c.Background = Brushes.Black; } else { c.Background = Brushes.Transparent; } } Tiles.Add(c); } } }
private void FillEmpty() { Func <int, bool> IsOdd = x => x % 2 != 0; Tiles = new ObservableCollection <CellVM>(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { CellVM c = new CellVM(i, j); if (IsOdd(i)) { if (IsOdd(j)) { c.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#fece9e")); } else { c.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#d18a47")); } } else { if (IsOdd(j)) { c.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#d18a47")); } else { c.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#fece9e")); } } Tiles.Add(c); } } }