private void CreateInitialTextboxesAndAddToPanel(int rowCounter, Vamvakera vamvakera) { Canvas root = new Canvas(); root.Margin = new Thickness(0, 20, 0, 0); TextBox colNumber = new TextBox(); TextBox colName = new TextBox(); Canvas.SetLeft(colNumber, 0); Canvas.SetTop(colNumber, 0); colNumber.Name = "colNumber" + rowCounter; this.RegisterName(colNumber.Name, colNumber); colNumber.Text = vamvakera.ColourNo; colNumber.IsReadOnly = true; colNumber.Height = 20; colNumber.Width = 25; colName.Name = "colName" + rowCounter; this.RegisterName(colName.Name, colName); colName.Text = vamvakera.ColourName; colName.Margin = new Thickness(25, 0, 0, 0); colName.IsReadOnly = true; colName.Height = 20; colName.Width = 120; if (rowCounter % 2 == 0) { colName.Background = new SolidColorBrush(Color.FromArgb(0, 0, 96, 97)); colNumber.Background = new SolidColorBrush(Color.FromArgb(0, 0, 96, 97)); } // nameScope.RegisterName("col" + i, colNumber); // nameScope.RegisterName("root" + i, root); root.Children.Add(colNumber); root.Children.Add(colName); // root.Children.Add(b140first); stackPanel.Children.Add(root); //b140first.Margin = new Thickness(140, 0, 0, 0); //b140first.Text = vamvakera.B140first.ToString(); //b140first.Name = "b140first"; //b140first.IsReadOnly = false; //b140first.Height = 20; //b140first.Width = 25; //b140first.LostFocus += new RoutedEventHandler(OnLostFocus); }
private static void SelectColumn(Vamvakera vamvakera, int columnCounter, ref int?firstColumnName, ref int?lastColumnName) { switch (columnCounter) { case 0: firstColumnName = vamvakera.B140first; lastColumnName = vamvakera.B140last; break; case 1: firstColumnName = vamvakera.B120first; lastColumnName = vamvakera.B120last; break; case 2: firstColumnName = vamvakera.O130first; lastColumnName = vamvakera.O130last; break; case 3: firstColumnName = vamvakera.B260first; lastColumnName = vamvakera.B260last; break; case 4: firstColumnName = vamvakera.B250first; lastColumnName = vamvakera.B250last; break; case 5: firstColumnName = vamvakera.B240first; lastColumnName = vamvakera.B240last; break; case 6: firstColumnName = vamvakera.B234first; lastColumnName = vamvakera.B234last; break; case 7: firstColumnName = vamvakera.B280first; lastColumnName = vamvakera.B280last; break; default: throw new Exception("Invalid Column Counter"); } }