In this scenario, the Browsable(false) attribute is set to both properties which are used to create the self-referencing hierarchy. When the columns are predefined, running that application will freeze as the RadGridView could not correctly get the parent row. If the columns are auto-generated, this behavior is not observed.
This is not exactly a real solution as setting the Browsable(false) attribute will remove the properties from the source. However, the control should not freeze the application.
maskBoxColumn.FormatInfo = CultureInfo.CreateSpecificCulture("en-AE");
RadGridview 1.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.HeaderCells)
To reproduce use the code below:
DataTable table = new DataTable();
for (int i = 0; i < 20; i++)
{
table.Columns.Add("Left" + i, typeof(int));
table.Columns.Add("Right" + i, typeof(int));
}
for (int i = 0; i < 27; i++)
{
List<object> parameters = new List<object>();
for (int j = 0; j < table.Columns.Count - 2; j++)
{
parameters.Add(100 * i + i);
}
table.Rows.Add(parameters.ToArray());
}
this.radGridView1.DataSource = table;
ColumnGroupsViewDefinition def = new ColumnGroupsViewDefinition();
for (int i = 0, j = 0; i < 20; i++)
{
var group = new GridViewColumnGroup("Group" + 3 + i);
def.ColumnGroups.Add(group);
group.Groups.Add(new GridViewColumnGroup("0"));
group.Groups[0].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 30});
group.Groups[0].Rows[0].ColumnNames.Add(this.radGridView1.Columns[j].Name);
this.radGridView1.Columns[j].Width = 58;
j++;
group.Groups[0].Rows[0].ColumnNames.Add(this.radGridView1.Columns[j].Name);
this.radGridView1.Columns[j].Width = 58;
j++;
}
radGridView1.MasterTemplate.ShowRowHeaderColumn = false;
this.radGridView1.ViewDefinition = def;
// To Export:
GridViewPdfExport pdfExport = new GridViewPdfExport(this.radGridView1);
pdfExport.FitToPageWidth = false;
pdfExport.ExportViewDefinition = true;
pdfExport.ExportVisualSettings = true;
pdfExport.RunExport(@"..\..\pdf", new PdfExportRenderer());
There is a sample project attached and the result is illustrated below:
200%:
100%:
When typing text in a new row in the RadGridView control with Windows 11 theme, the text appears to be moved down from the top of the row and makes it look like it is hidden, thus making it hard to see.
I am using all the defaults of the RadGridView control with AutoSizeRows = true.
By default, in the Property Builder for GridView, the defaults are:
Header Text Alignment = Middle Center
Text Alignment = Middle Left.
This means that EVERY time I create a new grid, I have to remember to make them both the same.
Why make them different? It makes the grid look rubbish whenthe defaults are used.