private void EditExistingBox(PuzzleWord word, int startCol, int startRow) { //Don't need to check if the expected letters are the same because we already checked them var theBoxList = TheGrid.Children.Cast <UIElement>().Where(k => (Grid.GetRow(k) == startRow) && (Grid.GetColumn(k) == startCol)).ToList(); PuzzleLetter theBox = theBoxList[theBoxList.Count - 1] as PuzzleLetter; //Some grid boxes contain labels as well as textboxes. The textboxes are always added last if ((HeaderTemp.GetDefaultNumber(theBox) == "") && ((startCol == word.StartColumn) && (startRow == word.StartRow))) { HeaderTemp.SetDefaultNumber(theBox, word.ClueNumber.ToString()); } }
public PuzzleLetter(char expectedLetter, string defaultNumber = "") { ExpectedLetter = Char.ToUpper(expectedLetter); this.Style = (Style)FindResource("TextBoxStyle"); HeaderTemp.SetDefaultNumber(this, defaultNumber); this.MaxLength = 1; this.Text = ""; this.FontSize = 24; this.HorizontalContentAlignment = HorizontalAlignment.Center; this.VerticalContentAlignment = VerticalAlignment.Center; this.CharacterCasing = CharacterCasing.Upper; this.Background = new SolidColorBrush(Colors.White); this.Foreground = new SolidColorBrush(Colors.Black); }