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>"; } } }
When RadGridView is scrolled while selecting (SelectionMode is CellSelect), the control throws exception.
1. Create a new project with RadGridView. 2. Setup self-referencing hierarchy with 1000 rows and 14 columns. 3. Run the project. 4. Scroll up and down several times. 5. Resize the window. 6. Scroll up and down again. 7. RadGridView will hang.
In particular customers want to add a button showing the excel like filter popup.
When you copy from excel & if there are some empty columns in the excel file those empty columns aren't copied.The grid simply ignores the empty columns.Just run the attached sample project and copy the content from excel file and paste on the grid.T
Closing a form in CellDoubleClick event causes NullReferenceException in RadGridView.
Filtering in self-reference hierarchy should be performed over the rows from all levels
If you dispose the grid or the form it is placed on the grid's DoubleClick, MouseDoubleClick, MouseDown, etc. events, an exception is thrown.
Add the ability to print all levels of a hierarchical RadGridView.
1. Create a new project with RadGridView and setup hierarchy with three levels. 2. Add a button and when handling its Click event call the ExpandAll method. 3. Run the project and expand the first row. 4. Click the button.
1. Create a new project with RadGridView. 2. Setup hierarchy with two child templates. 3. Set the AutoSizeRows to true. 4. Run the project, select the second template on 5 consecutive rows. 5. Start scrolling up and down with the mouse wheel slowly. 6. Click on a child row.
FIX. RadGridView - FilterOperator.IsEqualTo and FilterOperator.IsNotEqualTo should work with null using System; using System.Data; using System.Windows.Forms; using Telerik.WinControls.Data; using Telerik.WinControls.UI; namespace Lab.Grid { public partial class GridFilterEqualNullSupport : MainForm { private RadGridView gridView = new RadGridView(); public GridFilterEqualNullSupport() { InitializeComponent(); gridView.Dock = DockStyle.Fill; gridView.Parent = this; gridView.BringToFront(); gridView.EnableFiltering = true; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); DataTable table = new DataTable(); table.Columns.Add("Id", typeof(int)); table.Columns.Add("Name"); table.Columns.Add("Number", typeof(DateTime)); table.Rows.Add(1, "Ivan", DateTime.Now); table.Rows.Add(2, "Ivan", DateTime.Now.AddDays(-1)); table.Rows.Add(null, "Peter", DateTime.Now); table.Rows.Add(4, "George", null); table.Rows.Add(5, "George", null); table.Rows.Add(null, "George", null); table.Rows.Add(7, "Enzo", DateTime.Now.AddDays(-3)); table.Rows.Add(8, "Enzo", DateTime.Now.AddDays(5)); table.Rows.Add(null, "Enzo", null); table.Rows.Add(10, "Enzo", DateTime.Now.AddDays(-1)); gridView.DataSource = table; } protected override void OnButton1Click() { base.OnButton1Click(); FilterDescriptor filter1 = new FilterDescriptor("Id", FilterOperator.IsEqualTo, null); gridView.FilterDescriptors.Add(filter1); } protected override void OnButton2Click() { base.OnButton2Click(); FilterDescriptor filter1 = new FilterDescriptor("Id", FilterOperator.IsNotEqualTo, null); gridView.FilterDescriptors.Add(filter1); } protected override void OnButton3Click() { FilterDescriptor filter1 = new FilterDescriptor("Id", FilterOperator.IsEqualTo, ""); gridView.FilterDescriptors.Add(filter1); } } } 1. Open attached project and run it. 2. Click button 1 and you will see that is not apply
The check box should be placed in the header cell (if the users wants to). Additionally it should be able to control both one level and hierarchy Resolution: You need to set the EnableHeaderCheckBox property to true. Please refer in help article for more information: http://www.telerik.com/help/winforms/gridview-columns-gridviewcheckboxcolumn.html
Use the ticket project: - type in filtercell T2 the following text: test - make no commit of the filter cell! - click directly on the radbutton of the ribbonbar - click in the filter cell of T2 - click in grid - click in filter cell of T2 - click in grid
1. Create a new project with RadGridView and bind it. 2. Run the application. 3. Double click on a column to best fit. 4. Double click the same column twice