/// <summary>Deafult Constructor</summary> public SudokuViewWindow() { _sudokuGrid = Init(); // Populate SudokuCellSetHandler onsetHandler = new SudokuCellSetHandler(Cell_OnSet); SudokuCellClearHandler onclearHandler = new SudokuCellClearHandler(Cell_OnClear); for (var row = 0; row < Dimension; ++row) { for (var col = 0; col < Dimension; ++col) { SudokuCellUserControl cell = new SudokuCellUserControl(); cell.OnSet += onsetHandler; cell.OnClear += onclearHandler; Grid.SetRow(cell, row); Grid.SetColumn(cell, col); _sudokuGrid.Children.Add(cell); _sudokuCells.Add(cell); } } // Add the Grid (Hidden at first) grid.Children.Add(_sudokuGrid); }
/// <summary>Duplicate this Cell</summary> /// <remarks>There will be no listesners.</remarks> /// <returns>The Duplicate</returns> public virtual ISudokuViewCell Duplicate() { SudokuCellUserControl newCell = new SudokuCellUserControl(this.BackgroundColor); newCell._bigBlock.Visibility = this._bigBlock.Visibility; newCell._bigBlock.Text = this._bigBlock.Text; newCell._readonly = this._readonly; newCell.Background = this.Background; newCell.Foreground = this.Foreground; for (int i = 0; i < _blocks.Count; ++i) { newCell._blocks[i].Visibility = this._blocks[i].Visibility; } return newCell; }