//private byte[] Rules = Enumerable.Repeat((byte)0, 64).ToArray(); //private ObservableCollection<byte> ItemSource; public MainWindow() { InitializeComponent(); _timer.Elapsed += _timer_Elapsed; Cell.CreateCells(); LayerSelector.Maximum = Cell.LayerCount - 1; var cellSize = Cell.Size * 2 * Cell.SizeCount; _wb = new WriteableBitmap(cellSize, cellSize, 72, 72, PixelFormats.Gray8, BitmapPalettes.Gray256); MainImage.Source = _wb; Cell.BackBufferStride = _wb.BackBufferStride; //var bytes = new byte[] { 0xFF,0x00}; //for (var i = 0; i < Cell.Rules.Length; i++) //{ // Rules[i] = (byte) ((i << 1) | (Cell.Rules[i] == true ? 1 : 0)); // Rules[i] = (byte) ((Rules[i] << 1) | (Cell.Rules[i] == null ? 0 : 1)); //} //ItemSource = new ObservableCollection<byte>(Rules); //RuleItems.ItemsSource = ItemSource; SurvivalsRule.ItemsSource = new ObservableCollection <Rule>(Enumerable.Range(0, 9).Select(x => new Rule { Index = x })); BirthsRule.ItemsSource = new ObservableCollection <Rule>(Enumerable.Range(0, 9).Select(x => new Rule { Index = x })); }