1. Create a new project with RadGridView and bind it. 2. Setup 2 level grouping. 3. Add top summary row. 4. Set the ShowParentGroupSummaries property to true. 5. Run the project and expand a group. 6. Edit a cell from a column that has a summary item attached. 7. Notice that the parent summary row is not updated properly.
If a dock window is focused programmatically, the RowValidating event is fired before selecting the new row by mouse cursor.
To reproduce: - use the code below to create an application - start it and click the Id column twice (so you will sort it first ascending and then descending) - double click the first row (with ID=9) => the BindingList current is still the row with ID 0, while it should be the row with ID 9 public partial class Form1 : Form { public Form1() { InitializeComponent(); SetDefaults(); } private void SetDefaults() { radGridView1.MasterTemplate.AutoGenerateColumns = false; radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; radGridView1.MasterTemplate.EnableAlternatingRowColor = true; radGridView1.TableElement.AlternatingRowColor = Color.FromArgb(0xEB, 0xEF, 0xFB); radGridView1.MasterTemplate.ShowGroupedColumns = true; radGridView1.MasterTemplate.EnableGrouping = true; radGridView1.MasterTemplate.MultiSelect = false; radGridView1.EnableFiltering = true; radGridView1.EnableFastScrolling = true; radGridView1.TableElement.TableHeaderHeight = 50; } private void Form1_Load(object sender, EventArgs e) { var users = new EmployeeList(); for (int i = 0; i < 10; i++) { var user = new Employee(); user.Id = i; user.Name = "John Doe " + i; users.Add(user); } employeeListBindingSource.DataSource = users; } private void radGridView1_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { if (e.RowIndex == -1 || e.Row.RowElementType != typeof(GridDataRowElement) || !(e.Row is GridViewDataRowInfo)) return; var selectedUser = employeeListBindingSource.Current as Employee; MessageBox.Show(selectedUser.Name); } } public class Employee { public int Id { get; set; } public string Name { get; set; } public Employee() { } } public class EmployeeList : BindingList<Employee> { public EmployeeList() { } }
There should be a way to determine if the row was deleted through the cell or row header context menu or by pressing the delete key.
Copy of cells from second level in hierarchy does not work.
To reproduce: rgvTest.BeginUpdate() For ixTest As Integer = 1 To 2000 Dim rgvrTest As GridViewRowInfo = rgvTest.Rows.AddNew rgvrTest.Cells(0).Value = "Value " & ixTest.ToString Next rgvTest.EndUpdate() rgvTest.Rows(0).IsCurrent = True MessageBox.Show(rgvTest.CurrentCell.RowIndex.ToString)
1. Create a RadGridView and setup hierarchy. 2. Add a group descriptor and several rows in the child view so that when expanding it scrollbar appears. 3. Run the project and expand the first row (there should be only one row at first level and one group at second level).
1. Create a new project with RadGridView. 2. Bind it to a business object collection without rows. 3. Add a descending sort descriptor for a date time column. 4. Add a button and on its click event add a new row to the collection. The new row should have first column with data which produces different sort results than the date time column. 5. Run the project and add some rows.
To reproduce - Have a page view with two pages - one empty and one with a grid - put some cell in the grid in edit mode and cancel its validation in the CellValidating event - at this point you cannot change the current cell in the grid (which is desired) but you are able to switch to another page in the page view, thus its SelectedPageChanging event fires (which is not desired)
Exception is thrown when a property of data bound record is changed and filtering is applied
To reproduce - bind the grid to a binding list - pin one of the rows - delete this row from the binding list - click somewhere on the grid => exception is thrown
Plese download the attached project and run it. It uses some of our internal data so plese keep it private. Once you get the GridView with the data do the following: 1. Click on "Mahine speed" Header to change sort order. 2. Open "Mahine speed" filter and deselect all and select 1 3. Open "Mahine speed" filter and deselect 1 and select 2 4. Open "Mahine speed" filter and deselect 2 and select 3 5. Open "Mahine speed" filter and deselect 3 and select 1 At this point you get the crash. The above steps are for you to be able to reproduce the issue,, in general terms, the issue happens if I reproduce the same steps in any Combobox column. This is causing crashes all along my project since most of the forms in my project are gridviews and users use a lot sorting and filtering to get to the needed data.
NullReferenceException when the Text property of RadDropDownListEditor is initialized with null value in the CellEditorInitialized event.
To reproduce use the code above and when the application starts double click the column in order to best fit it : RadGridView radGridView1 = new RadGridView(); this.Controls.Add(radGridView1); radGridView1.Columns.Add("some text"); radGridView1.HideSelection = true;
1. Create a new project with RadGridView and set MultiSelect to true and SelectionMode to CellSelect. 2. Run the project. 3. Use the mouse to select some cells and scroll down while selecting. 4. Remove some cells from the selection. 5. Scroll with the scrollbar up to the first selected cells. You will see that all previously selected cells which are not visible are not selected. Workaround: Use the following custom behavior: public class MyGridRowBehavior : GridDataRowBehavior { private FieldInfo oldCurrentLocationFieldInfo; private Point oldCurrentLocation { get { if (this.oldCurrentLocationFieldInfo == null) { this.oldCurrentLocationFieldInfo = typeof(GridRowBehavior).GetField("oldCurrentLocation", BindingFlags.Instance | BindingFlags.NonPublic); } return (Point)this.oldCurrentLocationFieldInfo.GetValue(this); } set { this.oldCurrentLocationFieldInfo.SetValue(this, value); } } private MethodInfo selectIntersectedCellsMethodInfo; private delegate void SelectIntersectedCellsDelegate(RadElementCollection rows, bool isProcessedShiftOrControl); private SelectIntersectedCellsDelegate SelectIntersectedCellsCore; private void SelectIntersectedCells(RadElementCollection rows, bool isProcessedShiftOrControl) { if (this.selectIntersectedCellsMethodInfo == null) { this.selectIntersectedCellsMethodInfo = typeof(GridRowBehavior).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic).First(x => x.Name == "SelectIntersectedCells" && x.GetParameters().Length == 2); this.SelectIntersectedCellsCore = (SelectIntersectedCellsDelegate)Delegate.CreateDelegate(typeof(SelectIntersectedCellsDelegate), this, this.selectIntersectedCellsMethodInfo); } this.SelectIntersectedCellsCore(rows, isProcessedShiftOrControl); } private MethodInfo selectIntersectedRowsMethodInfo; private delegate bool SelectIntersectedRowsDelegate(RadElementCollection rows); private SelectIntersectedRowsDelegate SelectIntersectedRowsCore; private bool SelectIntersectedRows(RadElementCollection rows) { if (this.selectIntersectedRowsMethodInfo == null) { this.selectIntersectedRowsMethodInfo = typeof(GridRowBehavior).GetMethod("SelectIntersectedRows", BindingFlags.Instance | BindingFlags.NonPublic); this.SelectIntersectedRowsCore = (SelectIntersectedRowsDelegate)Delegate.CreateDelegate(typeof(SelectIntersectedRowsDelegate), this, this.selectIntersectedRowsMethodInfo); } return this.SelectIntersectedRowsCore(rows); } protected override bool ProcessMouseSelection(Point mousePosition, GridCellElement currentCell) { if (this.RootGridBehavior.LockedBehavior != this) { this.GridControl.Capture = true; this.RootGridBehavior.LockBehavior(this); } GridCellElement mouseDownCell = this.GetCellAtPoint(this.MouseDownLocation); GridCellElement oldCurrentCell = this.GetCellAtPoint(this.oldCurrentLocation); bool isValidResizingContext = this.ResizeSelectionRectangle(currentCell, mousePosition); bool result = false; if (isValidResizingContext && oldCurrentCell != currentCell) { if (this.MasterTemplate.MultiSelect && !this.GridViewElement.Template.AllowRowReorder) { if (this.MasterTemplate.SelectionMode == GridViewSelectionMode.FullRowSelect) { bool selectedRowsChanged = false; bool isPressedShiftOrControl = (this.IsPressedShift || this.IsPressedControl); GridTableElement tableElement = this.GridViewElement.CurrentView as GridTableElement; RadElementCollection scrollableRows = tableElement.ViewElement.ScrollableRows.Children; RadElementCollection topPinnedRows = tableElement.ViewElement.TopPinnedRows.Children; RadElementCollection bottomPinnedRows = tableElement.ViewElement.BottomPinnedRows.Children; GridViewRowInfo[] selectedRows = this.MasterTemplate.SelectedRows.ToArray(); tableElement.BeginUpdate(); int oldSelectedRows = this.MasterTemplate.SelectedRows.Count; if (!isPressedShiftOrControl) { for (int i = selectedRows.Length - 1; i >= 0; i--) { GridViewRowInfo rowInfo = selectedRows[i]; GridRowElement rowElement = tableElement.GetRowElement(rowInfo); bool select = rowElement != null && rowElement.ControlBoundingRectangle.IntersectsWith(this.GridViewElement.SelectionRectangle); if (select) { rowInfo.IsSelected = true; } if (!rowInfo.IsSelected) { selectedRowsChanged = true; } } } selectedRowsChanged = this.SelectIntersectedRows(topPinnedRows); selectedRowsChanged |= this.SelectIntersectedRows(scrollableRows); selectedRowsChanged |= this.SelectIntersectedRows(bottomPinnedRows); if (oldSelectedRows != this.MasterTemplate.SelectedRows.Count) { selectedRowsChanged = true; } tableElement.EndUpdate(false); } else { GridTableElement tableElement = this.GridViewElement.CurrentView as GridTableElement; if (tableElement == null) { return result; } CancelEventArgs cancelArgs = new CancelEventArgs(); this.MasterTemplate.EventDispatcher.RaiseEvent<CancelEventArgs>(EventDispatcher.SelectionChanging, this, cancelArgs); if (cancelArgs.Cancel) { return result; } //Since version Q2 2014 (version 2014.2.617), please use: //GridViewSelectionCancelEventArgs cancelArgs = new GridViewSelectionCancelEventArgs(this.MasterTemplate.CurrentRow, this.MasterTemplate.CurrentColumn); //this.MasterTemplate.EventDispatcher.RaiseEvent<GridViewSelectionCancelEventArgs>(EventDispatcher.SelectionChanging, this, cancelArgs); //if (cancelArgs.Cancel) //{ // return result; //} this.GridViewElement.CurrentView.BeginUpdate(); bool isProcessedShiftOrControl = (this.IsPressedShift || this.IsPressedControl); int count = this.MasterTemplate.SelectedCells.Count; RadElementCollection scrollableRows = tableElement.ViewElement.ScrollableRows.Children; RadElementCollection topPinnedRows = tableElement.ViewElement.TopPinnedRows.Children; RadElementCollection bottomPinnedRows = tableElement.ViewElement.BottomPinnedRows.Children; this.SelectIntersectedCells(scrollableRows, isProcessedShiftOrControl); this.SelectIntersectedCells(topPinnedRows, isProcessedShiftOrControl); this.SelectIntersectedCells(bottomPinnedRows, isProcessedShiftOrControl); bool notifyUpdates = true; if (isProcessedShiftOrControl) { notifyUpdates = count != this.MasterTemplate.SelectedCells.Count; } this.GridViewElement.CurrentView.EndUpdate(false); this.GridViewElement.Invalidate(); } result = true; } result = false; } this.oldCurrentLocation = mousePosition; return result; } } Register the new behavior as follows: BaseGridBehavior behavior = (BaseGridBehavior)this.radGridView1.GridBehavior; behavior.UnregisterBehavior(typeof(GridViewDataRowInfo)); behavior.RegisterBehavior(typeof(GridViewDataRowInfo), new MyGridRowBehavior());
Allow drag and drop of rows, when RadGridView is in bound mode. Please refer to the following article demonstrating how to do that: http://www.telerik.com/help/winforms/gridview-rows-drag-and-drop.html
Workaround: to avoid this behavior iterate the Rows collection of the master template and invoke their HasChildRows() method. which will sync up their parent
FIX. When you reorder columns in RadGridView, the visual indicator is position out side of the grid, if the column is intersected with control's width.
Currently all exported cells are static.
There should be a way to enable the auto filter functionality of Excel when exporting a grid through ExportToExcelML. To enable the AutoFilter for cells C1 to C4 on row 2: ExportToExcelML exporter = new ExportToExcelML(this.radGridView1); exporter.ExcelTableCreated += new ExcelTableCreatedEventHandler(exporter_ExcelTableCreated); exporter.RunExport(file.FullName); private void exporter_ExcelTableCreated(object sender, ExcelTableCreatedEventArgs e) { AutoFilterElement el = new AutoFilterElement(); el.Attributes.Add("x:Range", "R2C1:R2C4"); el.Attributes.Add("xmlns", "urn:schemas-microsoft-com:office:excel"); e.ExcelTableElement.Workbook.Worksheets[0].InnerElements.Add(el); } private class AutoFilterElement : Telerik.WinControls.UI.Export.ExcelML.ElementBase { protected override string StartTag { get { return "<AutoFilter{0}>"; } } protected override string EndTag { get { return "</AutoFilter>"; } } }