Hi everyone!
We are doing a project, and use it in GridView and its capabilities. We had a problem with GridViewColumnGroup. Grid is used to display services for a week, and have the button to show / not show weekend. By default, the “show weekend” is disabled. When we click the button “show weekend”, the weekend columns for some reason added small, and not as the same width as the weekdays. But if you do show weekend the default, they appear normal. But if you then show \ not show the weekend, they are becoming less and less.
Please help me! On the form located only a standard RadGridView and CheckBox.
Sorry for my English.
We are doing a project, and use it in GridView and its capabilities. We had a problem with GridViewColumnGroup. Grid is used to display services for a week, and have the button to show / not show weekend. By default, the “show weekend” is disabled. When we click the button “show weekend”, the weekend columns for some reason added small, and not as the same width as the weekdays. But if you do show weekend the default, they appear normal. But if you then show \ not show the weekend, they are becoming less and less.
public partial class Form1 : Form{ private static readonly List<string> DaysOfWorkingWeekList = new List<string>(new[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}); private static readonly List<string> DaysOfWeekList = new List<string>(new[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }); public Form1() { InitializeComponent(); foreach (var column in GetColumns()) { rgvMain.MasterTemplate.Columns.Add(column); } rgvMain.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; UpdateGroupHeader(); var serviceWeeks = new List<ServiceWeek>(); var serviceWeek = new ServiceWeek(); serviceWeeks.Add(serviceWeek); rgvMain.DataSource = serviceWeeks; } private void UpdateGroupHeader() { AddGroupHeader(rgvMain.MasterTemplate, radCheckBox1.IsChecked ? DaysOfWeekList : DaysOfWorkingWeekList); rgvMain.MasterTemplate.Refresh(); } private void radCheckBox1_CheckStateChanged(object sender, EventArgs e) { UpdateGroupHeader(); } public void AddGroupHeader(GridViewTemplate template, List<string> groupHeaderText) { var columnGroupsView = new ColumnGroupsViewDefinition(); for (int i = 0, index = 0; index < groupHeaderText.Count; index++) { columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup(groupHeaderText[index])); columnGroupsView.ColumnGroups[index].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[index].Rows[0].Columns.Add(template.Columns[i++]); columnGroupsView.ColumnGroups[index].Rows[0].Columns.Add(template.Columns[i++]); } template.ViewDefinition = columnGroupsView; } private IEnumerable<GridViewTextBoxColumn> GetColumns() { return new List<GridViewTextBoxColumn> { new GridViewTextBoxColumn(), new GridViewTextBoxColumn {Width = 50, MinWidth = 50, MaxWidth = 50}, new GridViewTextBoxColumn(), new GridViewTextBoxColumn {Width = 50, MinWidth = 50, MaxWidth = 50}, new GridViewTextBoxColumn(), new GridViewTextBoxColumn {Width = 50, MinWidth = 50, MaxWidth = 50}, new GridViewTextBoxColumn(), new GridViewTextBoxColumn {Width = 50, MinWidth = 50, MaxWidth = 50}, new GridViewTextBoxColumn(), new GridViewTextBoxColumn {Width = 50, MinWidth = 50, MaxWidth = 50}, new GridViewTextBoxColumn(), new GridViewTextBoxColumn {Width = 50, MinWidth = 50, MaxWidth = 50}, new GridViewTextBoxColumn(), new GridViewTextBoxColumn {Width = 50, MinWidth = 50, MaxWidth = 50} }; }}public class Service{}public class ServiceWeek{ public Service MondayService { get; set; } public Service SundayService { get; set; } public Service SaturdayService { get; set; } public Service FridayService { get; set; } public Service ThursdayService { get; set; } public Service WednesdayService { get; set; } public Service TuesdayService { get; set; }}Please help me! On the form located only a standard RadGridView and CheckBox.
Sorry for my English.