void addingNewPage(int key) { dataGridHelper.getFirstPage(); Button canvasButton = new Button(); canvasButton.Style = (Style)FindResource("window"); canvasButton.Margin = new Thickness(-9, 1, 0, 0); canvasButton.Height = 20; canvasButton.Width = 92; Canvas canvastab = new Canvas(); canvastab.Width = 92; canvastab.Height = 20; Path pathsquare = new Path(); pathsquare.Data = Geometry.Parse(@"F1M2,1.644C2,1.644 2,20 2,20 2,20 77.831,20 77.831,20 77.831,20 91.619,1.644 91.619,1.644 91.619,1.644 2,1.644 2,1.644z"); pathsquare.Fill = Brushes.Black; pathsquare.Height = 20; pathsquare.Width = 92; pathsquare.Stretch = Stretch.Fill; Button buttonsquare = new Button(); buttonsquare.Name = "_pathsquare"; buttonsquare.Style = (Style)FindResource("window"); buttonsquare.Content = pathsquare; TextBlock text = new TextBlock(); text.Name = "Sheettext"; text.Text = "Sheet- " + key.ToString(); text.Foreground = Brushes.White; text.FontSize = 16; Canvas.SetLeft(text, 4); Canvas.SetTop(text, -2); Button buttonkatta = new Button(); buttonkatta.Style = (Style)FindResource("CloseButton"); buttonkatta.Height = 10; buttonkatta.Width = 10; buttonkatta.Name = "CloseCurrentClick"; buttonkatta.Command = DeleteCommand; Canvas.SetLeft(buttonkatta, 68.5); Canvas.SetTop(buttonkatta, 5); canvastab.Children.Add(buttonsquare); canvastab.Children.Add(buttonkatta); canvastab.Children.Add(text); canvasButton.Content = canvastab; canvasButton.Click += SheetSelectButton_Click; buttontabcanvaswrap.Children.Add(canvasButton); buttonList.Add(canvasButton, key); if (activeButton != null) { changeSheetButton(activeButton, canvasButton); } activeButton = canvasButton; }