1. Create a new project with RadGridView 2. Setup a hierarchy with a large number of rows 3. Apply grouping and expand all child views 4. Run the project and try to scroll
I still have the performance problem. I have attached the same project extende by a new button/(function to create a new group with one root entry and 100 sub-entries. This takes a while due to the log of the data context, but what really takes me off is the performance of the grid when opening this root entry. On my machine (i5, 4GB ram) it takes about 5-6 seconds for the sub-structure to open. The zip also contains an old version of the program and in the bin/debug folder you can find the "RadTest.exe" (as opposed to the RadTest2.exe), wich will open the sub-structure in no time. So - there must be something wrong with my way of working the grid. To reproduce: Run the program, click the "Generate" Button and enter a name for the new group. This will create 101 new entries (1 root, 100 subs), taking about 15-20 secs (which is ok, as I said above). Then open the "RootEntry" within the group -> takes 5-6 seconds. When the subentries are visible, scrolling the grid vertically is really slow as well.
1. Create a new project containing RadGridView 2. Set a DataSource 3. Set a ColumnGroupsViewDefinition 4. Apply grouping 5. Do all this on a button click 6. Run the application and click the button.
ADD. Paging functionality for RadGridView.
exception is thrown when the ListChanged event send ItemChanged notification before ItemAdded
FIX. RadGridView - reloading the datasource with auto size columns mode to fill and hidden row header column, causes the first column to expand of every data source setting with one pixel
Possibility user of control to add additional properties for serialization in xml file and load this repository with event to change behavior of control
exception is thrown when the ListChanged event send ItemChanged notification before ItemAdded
To reproduce, copy a date time cell value and paste in excel.
Workaround: add the option and the logic for it in the ContextMenuOpening event
To reproduce: radChartView1 = new RadChartView(); radChartView1.Parent = this; radChartView1.Dock = DockStyle.Fill; radChartView1.ShowGrid = true; CartesianGrid grid = ((CartesianGrid)radChartView1.GetArea<CartesianArea>().Grid); grid.DrawVerticalFills = true; grid.AlternatingHorizontalColor = false; grid.AlternatingVerticalColor = false; grid.BackColor = Color.Red; grid.ForeColor = Color.Blue; grid.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Solid; DateTimeContinuousAxis horizontalAxis = new DateTimeContinuousAxis(); horizontalAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Day; horizontalAxis.MajorStep = 2; horizontalAxis.LabelFormat = "{0:dd/MM/yyyy}"; LinearAxis verticalAxis1 = new LinearAxis(); verticalAxis1.AxisType = AxisType.Second; LinearAxis verticalAxis2 = new LinearAxis(); verticalAxis2.AxisType = AxisType.Second; verticalAxis2.HorizontalLocation = AxisHorizontalLocation.Right; LineSeries line1 = new LineSeries(); line1.HorizontalAxis = horizontalAxis; line1.VerticalAxis = verticalAxis1; LineSeries line2 = new LineSeries(); line2.HorizontalAxis = horizontalAxis; line2.VerticalAxis = verticalAxis2; line1.DataPoints.Add(new CategoricalDataPoint(26d, DateTime.Now.AddDays(-6))); line1.DataPoints.Add(new CategoricalDataPoint(20d, DateTime.Now.AddDays(-5))); line1.DataPoints.Add(new CategoricalDataPoint(12d, DateTime.Now.AddDays(-4))); line1.DataPoints.Add(new CategoricalDataPoint(15d, DateTime.Now.AddDays(-2))); line1.DataPoints.Add(new CategoricalDataPoint(21d, DateTime.Now.AddDays(-1))); line2.DataPoints.Add(new CategoricalDataPoint(32d, DateTime.Now.AddDays(-6))); line2.DataPoints.Add(new CategoricalDataPoint(52d, DateTime.Now.AddDays(-4))); line2.DataPoints.Add(new CategoricalDataPoint(35d, DateTime.Now.AddDays(-3))); line2.DataPoints.Add(new CategoricalDataPoint(36d, DateTime.Now.AddDays(-2))); line2.DataPoints.Add(new CategoricalDataPoint(11d, DateTime.Now.AddDays(-1))); this.radChartView1.Series.Add(line1); this.radChartView1.Series.Add(line2); Workaround - no
To reproduce: Add a GridViewImageColumn and set its FieldName to something that returns an empty string. You will notice that in the output window numerous first chance exceptions are being thrown.
To Reproduce: - Add GridViewCalculatorColumn to a RadGridView. - When you begin edit a cell the value is not selected. Workaround: Create a custom RadCalculatorEditor and then change the editor in EditorRequired event: void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e) { if (e.EditorType.Name == "RadCalculatorEditor") { e.Editor = new CustomCalculatorEditor(); } } public class CustomCalculatorEditor : RadCalculatorEditor { public override void BeginEdit() { base.BeginEdit(); RadCalculatorDropDownElement editorElement = this.EditorElement as RadCalculatorDropDownElement; editorElement.EditorContentElement.TextBoxItem.SelectAll(); } }
To reproduce: Add page view, add a tab, add a grid, dispose the controls inside the tab on its removing event. Exception may occur.
To reproduce use this code: public partial class Form1 : Form { RadGridView radGridView1 = new RadGridView(); public Form1() { InitializeComponent(); this.Controls.Add(this.radGridView1); this.radGridView1.Dock = DockStyle.Fill; this.radGridView1.AutoGenerateColumns = false; this.radGridView1.TableElement.RowHeight = 30; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.AddNewRowPosition = SystemRowPosition.Bottom; this.radGridView1.EnterKeyMode = RadGridViewEnterKeyMode.EnterMovesToNextCell; this.radGridView1.NewRowEnterKeyMode = RadGridViewNewRowEnterKeyMode.EnterMovesToNextCell; this.radGridView1.BeginEditMode = Telerik.WinControls.RadGridViewBeginEditMode.BeginEditOnKeystrokeOrF2; this.radGridView1.EnableGrouping = false; this.radGridView1.EnableAlternatingRowColor = true; this.radGridView1.AllowAddNewRow = true; this.radGridView1.AllowEditRow = true; this.radGridView1.AllowDeleteRow = true; this.radGridView1.EnableFiltering = true; this.radGridView1.EnableSorting = true; ArrayList arrayList = new ArrayList(); arrayList.Add(new Person() { Name = "Jack", Family = "J..." }); arrayList.Add(new Person() { Name = "Bob", Family = "B..." }); arrayList.Add(new Person() { Name = "Dani", Family = "D..." }); radGridView1.Columns.Add("ColName", "Name", "Name"); radGridView1.Columns.Add("ColFamily", "Family", "Family"); radGridView1.DataSource = arrayList; this.radGridView1.CellValidating +=radGridView1_CellValidating; } private void radGridView1_CellValidating(object sender, CellValidatingEventArgs e) { GridViewDataColumn column = e.Column as GridViewDataColumn; if ((e.Row is GridViewDataRowInfo || e.Row is GridViewNewRowInfo) && column != null && (column.Name == "ColName")) { if (e.Value == null || ((string)e.Value).Trim() == "") if (string.IsNullOrEmpty ((string)e.Value) || ((string)e.Value).Trim() == string.Empty || string.IsNullOrWhiteSpace ((string)e.Value)) { if (e.ActiveEditor != null) { MessageBox.Show("Please enter your name"); e.Cancel = true; } } } } } public class Person { private string name; private string family; public string Name { get { return name; } set { name = value; } } public string Family { get { return family; } set { family = value; } } } Try to add a new row by clicking the cell of the first column and leaving it empty. You will see the messagebox twice. Workaround: public class MyGridRowBehavior : GridNewRowBehavior { protected override bool ProcessEnterKey(KeyEventArgs keys) { GridViewNewRowInfo newRowInfo = (GridViewNewRowInfo)this.GridViewElement.CurrentRow; if (this.GridViewElement.NewRowEnterKeyMode == RadGridViewNewRowEnterKeyMode.EnterMovesToNextCell) { bool editorClosed = !this.IsInEditMode; if (this.IsInEditMode) { if (this.IsOnLastCell()) { if (newRowInfo != null) { newRowInfo.GetType().GetMethod("DeferUserAddedRow", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(newRowInfo, null); } editorClosed = GridViewElement.EndEdit(); } else { editorClosed = GridViewElement.CloseEditor(); } } if (editorClosed) { this.Navigator.SelectNextColumn(); this.GridViewElement.BeginEdit(); } if (this.IsInEditMode && this.GridViewElement.CurrentRow is GridViewNewRowInfo && this.GridViewElement.BeginEditMode != RadGridViewBeginEditMode.BeginEditProgrammatically) { return this.GridViewElement.BeginEdit(); } if (newRowInfo != null) { newRowInfo.GetType().GetMethod("RaiseUserAddedRow", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(newRowInfo, null); } return false; } return base.ProcessEnterKey(keys); } } ((BaseGridBehavior)this.radGridView1.GridBehavior).UnregisterBehavior(typeof(GridViewNewRowInfo)); ((BaseGridBehavior)this.radGridView1.GridBehavior).RegisterBehavior(typeof(GridViewNewRowInfo), new MyGridRowBehavior());
To reproduce: this.grid.Columns.Add(new GridViewDecimalColumn("col")); for (int i = 0; i < 5; i++) { this.grid.Rows.Add(i); } GridViewSummaryItem stDev = new GridViewSummaryItem() { Name = "col", Aggregate = GridAggregateFunction.Var // or GridAggregateFunction.StDev }; var row = new GridViewSummaryRowItem(); row.Add(stDev); this.grid.SummaryRowsTop.Add(row); This will throw an exception.
To reproduce: Create a project with RadGridView, add some rows, make sure you have space to perform panning. Pan up and down, exception should occur. Workaround : radgridView1.ViewDefinition = new MyTableViewDefinition(); public class MyTableViewDefinition : TableViewDefinition { public override IRowView CreateViewUIElement(GridViewInfo viewInfo) { return new MyGridTableElement(); } } public class MyGridTableElement : GridTableElement { protected override void OnPanGesture(Telerik.WinControls.PanGestureEventArgs args) { //base.OnPanGesture(args) -> you can stop touch support by also not calling the base and leaving this method empty if (args.IsBegin && (this.RowScroller.Scrollbar.ControlBoundingRectangle.Contains(args.Location) || this.ColumnScroller.Scrollbar.ControlBoundingRectangle.Contains(args.Location) || this.ViewElement.TopPinnedRows.ControlBoundingRectangle.Contains(args.Location))) { return; } bool containsCurrent = (this.GridViewElement.CurrentRow == null && this.GridViewElement.Template == this.ViewTemplate); if (!containsCurrent) { foreach (IRowView child in this.GridViewElement.GetRowViews(this.GridViewElement.CurrentRow.ViewInfo)) { containsCurrent |= (child == this); } } if (!containsCurrent) { return; } this.GridViewElement.EndEdit(); int newVerticalValue = this.RowScroller.Scrollbar.Value - args.Offset.Height; if (newVerticalValue > this.RowScroller.Scrollbar.Maximum - this.RowScroller.Scrollbar.LargeChange + 1) { newVerticalValue = this.RowScroller.Scrollbar.Maximum - this.RowScroller.Scrollbar.LargeChange + 1; } if (newVerticalValue < this.RowScroller.Scrollbar.Minimum) { newVerticalValue = this.RowScroller.Scrollbar.Minimum; } RadScrollBarElement rowScrollbar = this.RowScroller.Scrollbar; if (newVerticalValue > rowScrollbar.Maximum) { newVerticalValue = rowScrollbar.Maximum; } else if (newVerticalValue < 0) { newVerticalValue = 0; } this.RowScroller.Scrollbar.Value = newVerticalValue; int newHorizontalValue = this.ColumnScroller.Scrollbar.Value - args.Offset.Width; if (newHorizontalValue > this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1) { newHorizontalValue = this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1; } if (newHorizontalValue < this.ColumnScroller.Scrollbar.Minimum) { newHorizontalValue = this.ColumnScroller.Scrollbar.Minimum; } RadScrollBarElement columnScrollBar = this.ColumnScroller.Scrollbar; if (newHorizontalValue > columnScrollBar.Maximum) { newHorizontalValue = columnScrollBar.Maximum; } else if (newHorizontalValue < 0) { newHorizontalValue = 0; } this.ColumnScroller.Scrollbar.Value = newHorizontalValue; args.Handled = true; } }
To reproduce: - Use the code below on a new grid with 3 combo box columns - computer_id, computer_des, location_id public static DataTable dsComputerImages = null; public static DataTable dsLocations = null; private void loadComputerImagesGrid() { dsLocations = new DataTable(); DataColumn newColumn = new DataColumn("location_id", typeof(Int64)); dsLocations.Columns.Add(newColumn); newColumn = new DataColumn("location_des", typeof(String)); dsLocations.Columns.Add(newColumn); DataRow newRow = dsLocations.NewRow(); newRow["location_id"] = 1; newRow["location_des"] = "Boston"; dsLocations.Rows.Add(newRow); newRow = dsLocations.NewRow(); newRow["location_id"] = 2; newRow["location_des"] = "New York"; dsLocations.Rows.Add(newRow); newRow = dsLocations.NewRow(); newRow["location_id"] = 3; newRow["location_des"] = "Huston"; dsLocations.Rows.Add(newRow); dsComputerImages = new DataTable(); newColumn = new DataColumn("computer_id", typeof(Int64)); dsComputerImages.Columns.Add(newColumn); newColumn = new DataColumn("computer_des", typeof(String)); dsComputerImages.Columns.Add(newColumn); newColumn = new DataColumn("location_id", typeof(Int64)); dsComputerImages.Columns.Add(newColumn); newRow = dsComputerImages.NewRow(); newRow["computer_id"] = 1; newRow["computer_des"] = "AAA"; newRow["location_id"] = "1"; dsComputerImages.Rows.Add(newRow); newRow = dsComputerImages.NewRow(); newRow["computer_id"] = 2; newRow["computer_des"] = "BBB"; newRow["location_id"] = "1"; dsComputerImages.Rows.Add(newRow); newRow = dsComputerImages.NewRow(); newRow["computer_id"] = 3; newRow["computer_des"] = "CCC"; newRow["location_id"] = "2"; dsComputerImages.Rows.Add(newRow); newRow = dsComputerImages.NewRow(); newRow["computer_id"] = 4; newRow["computer_des"] = "DDD"; newRow["location_id"] = "3"; dsComputerImages.Rows.Add(newRow); this.ComputerImagesGrid.AutoGenerateColumns = false; this.ComputerImagesGrid.DataSource = dsComputerImages; this.ComputerImagesGrid.AutoSizeRows = true; } private void ComputerImagesGrid_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e) { ((GridViewComboBoxColumn)((RadGridView)sender).Columns["location_id"]).DataSource = dsLocations; ((GridViewComboBoxColumn)((RadGridView)sender).Columns["location_id"]).ValueMember = "location_id"; ((GridViewComboBoxColumn)((RadGridView)sender).Columns["location_id"]).DisplayMember = "location_des"; ((GridViewComboBoxColumn)((RadGridView)sender).Columns["location_id"]).DisplayMemberSort = true; }
To reproduce: Create a project with RadGridView, add some rows, make sure you have space to perform panning. Exception should occur. Workaround: this.myGridView.ViewDefinition = new MyTableViewDefinition(); public class MyTableViewDefinition : TableViewDefinition { public override IRowView CreateViewUIElement(GridViewInfo viewInfo) { return new MyGridTableElement(); } } public class MyGridTableElement : GridTableElement { protected override void OnPanGesture(Telerik.WinControls.PanGestureEventArgs args) { if (args.IsBegin && (this.RowScroller.Scrollbar.ControlBoundingRectangle.Contains(args.Location) || this.ColumnScroller.Scrollbar.ControlBoundingRectangle.Contains(args.Location) || this.ViewElement.TopPinnedRows.ControlBoundingRectangle.Contains(args.Location))) { return; } bool containsCurrent = (this.GridViewElement.CurrentRow == null && this.GridViewElement.Template == this.ViewTemplate); if (!containsCurrent) { foreach (IRowView child in this.GridViewElement.GetRowViews(this.GridViewElement.CurrentRow.ViewInfo)) { containsCurrent |= (child == this); } } if (!containsCurrent) { return; } this.GridViewElement.EndEdit(); int newVerticalValue = this.RowScroller.Scrollbar.Value - args.Offset.Height; if (newVerticalValue > this.RowScroller.Scrollbar.Maximum - this.RowScroller.Scrollbar.LargeChange + 1) { newVerticalValue = this.RowScroller.Scrollbar.Maximum - this.RowScroller.Scrollbar.LargeChange + 1; } if (newVerticalValue < this.RowScroller.Scrollbar.Minimum) { newVerticalValue = this.RowScroller.Scrollbar.Minimum; } this.RowScroller.Scrollbar.Value = newVerticalValue; int newHorizontalValue = this.ColumnScroller.Scrollbar.Value - args.Offset.Width; if (newHorizontalValue > this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1) { newHorizontalValue = this.ColumnScroller.Scrollbar.Maximum - this.ColumnScroller.Scrollbar.LargeChange + 1; } if (newHorizontalValue < this.ColumnScroller.Scrollbar.Minimum) { newHorizontalValue = this.ColumnScroller.Scrollbar.Minimum; } RadScrollBarElement scrollbar = this.ColumnScroller.Scrollbar; if (newHorizontalValue > scrollbar.Maximum) { newHorizontalValue = scrollbar.Maximum; } else if (newHorizontalValue < 0) { newHorizontalValue = 0; } this.ColumnScroller.Scrollbar.Value = newHorizontalValue; args.Handled = true; } }
To reproduce: Generate the hierarchy with the following code: radGridView1.SelectionMode = GridViewSelectionMode.CellSelect; radGridView1.MultiSelect = true; radGridView1.ClipboardCopyMode = GridViewClipboardCopyMode.EnableWithoutHeaderText; radGridView1.ClipboardPasteMode = GridViewClipboardPasteMode.Enable; radGridView1.AutoGenerateColumns = true; radGridView1.CellValueChanged += grid_CellValueChanged; //radGridView1.ViewCellFormatting += GridCellFormatting; //radGridView1.RowFormatting += grid_RowFormatting; radGridView1.EnableSorting = true; //radGridView1.MasterTemplate.EnableCustomSorting = true; radGridView1.AllowMultiColumnSorting = true; radGridView1.ShowGroupPanel = true; radGridView1.EnableFiltering = true; radGridView1.ShowFilteringRow = false; radGridView1.MasterTemplate.ShowHeaderCellButtons = true; DataTable dt1 = new DataTable(); dt1.Columns.Add("Column1"); dt1.Columns.Add("Column2"); dt1.Columns.Add("Column3"); dt1.Columns.Add("Column4"); dt1.Columns.Add("Column5"); dt1.Columns.Add("Column6"); dt1.Columns.Add("Column7"); dt1.Columns.Add("Column8"); dt1.Columns.Add("Column9"); dt1.Columns.Add("Column10"); DataTable dt2 = new DataTable(); dt2.Columns.Add("Column1"); dt2.Columns.Add("Column2"); dt2.Columns.Add("Column3"); dt2.Columns.Add("Column4"); dt2.Columns.Add("Column5"); dt2.Columns.Add("Column6"); dt2.Columns.Add("Column7"); dt2.Columns.Add("Column8"); dt2.Columns.Add("Column9"); var temp = new GridViewTemplate(); temp.AutoGenerateColumns = true; radGridView1.Templates.Add(temp); var rel = new GridViewRelation(radGridView1.MasterTemplate, temp); rel.ChildColumnNames.Add("Column1"); rel.ParentColumnNames.Add("Column1"); radGridView1.Relations.Add(rel); radGridView1.MasterTemplate.DataSource = dt1; dt1.Rows.Add(1, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9); dt1.Rows.Add(2, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9); dt1.Rows.Add(3, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9); dt1.Rows.Add(4, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9); dt1.Rows.Add(5, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6, 9); dt2.Rows.Add(1, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6); dt2.Rows.Add(1, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6); dt2.Rows.Add(1, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6); dt2.Rows.Add(2, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6); dt2.Rows.Add(2, "sdf", "sdfsfqwert", 1, 2, 3, 4, 7, 6); temp.DataSource = dt2; 1. Run the project with the generated hierarchy 2. Select second cell in first row. 3. Expand first row and select 3 cells in fifth column by mouse drag 4. Right click on selection and "Copy" or press Ctrl+C. 5. Try to Paste the data into 7-th column. 6. The data is pasted in the second column