private void AddMyUserControl1(int row, int col, string text, //Optional parameters: //Name or Id should be unique string name = "", Brush background = null, int id = -1, int cnrRad = -1, int colSpan = 1, int rowSpan = 1) { buttons[row][col] = new uc.RoundedButtonControl(row, col, text, TheGrid, name, background, id, cnrRad, colSpan, rowSpan); }
public void InitTheGrid(int x, int y, int Height = DefaultCellHeight, int Width = DefaultCellWidth, int space = DefaultCellSpacing) { TheGrid.Children.Clear(); TheGrid.RowSpacing = space; TheGrid.ColumnSpacing = space; buttons = new uc.RoundedButtonControl[x][]; for (int i = 0; i < x; i++) { buttons[i] = new uc.RoundedButtonControl[y]; RowDefinition rd2 = new RowDefinition(); rd2.Height = new GridLength((double)Height); TheGrid.RowDefinitions.Add(rd2); } for (int j = 0; j < y + TextSpan; j++) { ColumnDefinition cd2 = new ColumnDefinition(); cd2.Width = new GridLength((double)Width); TheGrid.ColumnDefinitions.Add(cd2); } var bdr = new Border { BorderThickness = new Thickness(1), BorderBrush = Black, Background = White, Padding = new Thickness(0), CornerRadius = new CornerRadius(5) }; TheGrid.Children.Add(bdr); Grid.SetColumn(bdr, y); Grid.SetRow(bdr, 0); Grid.SetColumnSpan(bdr, TextSpan); Grid.SetRowSpan(bdr, y + 1); //var tb = // new TextBlock // { // Text = "bla bla", // TextWrapping = TextWrapping.Wrap, // TextAlignment = TextAlignment.Left // }; //bdr.Child = tb; listView1 = new ListView() { Name = "MyList", IsEnabled = false, }; bdr.Child = listView1; clientListBox = listView1; }