or
gridView_Resize() event so it would call FillWidth() when there is a resize event. Where ever in your code when you show the grid the first time, just call to FillWidth() so it would look right in the case that that gridView_Resize() event does not fire.public void FillWidth(){ if (gridView.ColumnCount == 0) return; var width = CalcColumnsWidth(); if (width < gridView.ClientSize.Width) { // get the remain empty space in grid width = gridView.ClientSize.Width - width; int extraWidthPerColumn = width / gridView.ColumnCount; int i, limit = gridView.ColumnCount - 1; // stop before the last column for (i = 0; i < limit; i++) { if (gridView.Columns[i].MaxWidth > 0 && gridView.Columns[i].Width + extraWidthPerColumn > gridView.Columns[i].MaxWidth) { // do calculation before we lost the original width width -= (gridView.Columns[i].MaxWidth - gridView.Columns[i].Width); gridView.Columns[i].Width = gridView.Columns[i].MaxWidth; } else { gridView.Columns[i].Width += extraWidthPerColumn; width -= extraWidthPerColumn; } } // the last column get any remaining width gridView.Columns[i].Width += width; // This only add to the last column //gridView.Columns[gridView.ColumnCount - 1].Width += gridView.ClientSize.Width - width; }}private int CalcColumnsWidth(){ int width = 0; foreach (var column in gridView.Columns) width += column.Width; return width + gridView.ColumnCount + 15; //take into the vertical lines between columns and vertical scrollbar}private void gridView_Resize(object sender, EventArgs e){ gridView.MasterTemplate.BestFitColumns(); FillWidth();}RadDateTimeEditor editor = this.radGridView1.ActiveEditor as RadDateTimeEditor; if (editor != null) { RadDateTimeEditorElement editorElement = (RadDateTimeEditorElement)editor.EditorElement; editorElement.ShowUpDown = true; }Me
.RadChart.PlotArea.XAxis.DataLabelsColumn as far as I know.
However, I want to replace the X Axis labels with meaningful names I.e Jan Feb Mar etc...
I have tried adding this in during the loop and the labels show, but once the labels show, the data doesn't.
Please can you advise an easy way to get the X Axis labels to be set to a custom value
Thanks
Richard
Hello!
Was the meaning of GridCellElement.RowIndex property changed since 2009-Q3?
Please see the following code snippet:
01.public Form1() 02.{ 03. InitializeComponent(); 04. 05. radGridView1.Columns.Add(new GridViewTextBoxColumn("Group")); 06. radGridView1.Columns.Add(new GridViewTextBoxColumn("RowIndex")); 07. 08. for (int i = 0; i < 3; i++) 09. radGridView1.Rows.Add("Group 1"); 10. for (int i = 0; i < 3; i++) 11. radGridView1.Rows.Add("Group 2"); 12. 13. radGridView1.MasterTemplate.GroupDescriptors.Add(new GroupDescriptor("Group")); 14.} 15. 16.private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 17.{ 18. if (e.CellElement.ColumnInfo.Name == "RowIndex") 19. e.CellElement.Value = e.CellElement.RowIndex.ToString(); 20.} I expect the following result:
Group 1
0
1
2
Group 2
3
4
5
But the result is:
Group 1
0
1
2
Group 2
0
1
2
It seems that the RowIndex is an index inside the group but not the entire grid. Could you please confirm this?
Is the following workaround correct?
1.int rowIndex = radGridView1.Rows.IndexOf(e.CellElement.RowInfo);Thank you.