private void LoadUsers() { List <User> users = AdminQuery.GetUsers(); foreach (var user in users) { StackPanel horizontalUserPanel = new StackPanel(); horizontalUserPanel.Orientation = Orientation.Horizontal; CheckBox checkBox = new CheckBox(); checkBox.Uid = user.Id.ToString(); checkBox.Checked += this.checkBox_Checked; checkBox.Unchecked += this.checkBox_Unchecked; checkBox.Effect = this.btnDeleteIcon.Effect; horizontalUserPanel.Children.Add(checkBox); TextBlock textBlock = new TextBlock(); textBlock.Text = string.Format("Username: {0}; Email: {1}; Admin: {2}", user.Username, user.Email, user.IsAdmin); textBlock.FontSize = 20; textBlock.Foreground = Brushes.Black; textBlock.Width = 720; textBlock.Background = Brushes.Gray; textBlock.Margin = new Thickness(0, 0, 0, 10); textBlock.Effect = this.btnDeleteIcon.Effect; horizontalUserPanel.Children.Add(textBlock); Button btnRemoveUser = new Button(); btnRemoveUser.VerticalAlignment = VerticalAlignment.Top; btnRemoveUser.BorderBrush = Brushes.Transparent; btnRemoveUser.Uid = user.Id.ToString(); btnRemoveUser.Background = this.btnDeleteIcon.Background; btnRemoveUser.Width = 40; btnRemoveUser.Height = 40; btnRemoveUser.Effect = this.btnDeleteIcon.Effect; btnRemoveUser.Margin = new Thickness(0, 0, 0, 10); btnRemoveUser.Click += this.btnRemoveUser_Click; horizontalUserPanel.Children.Add(btnRemoveUser); this.usersContainer.Children.Add(horizontalUserPanel); } }