Steps to reproduce: 1. Add a CompositeFilterDescriptor programmatically as it is demonstrated in the following help article: http://docs.telerik.com/devtools/winforms/gridview/filtering/setting-filters-programmatically-(composite-descriptors) 2. Save the layout. 3. Load the layout. Use attached project to reproduce. Workaround: Seth te PropertyName to a valid column name.
To reproduce: DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("IsActive", typeof(bool)); dt.Rows.Add(1, "Parent1", false); dt.Rows.Add(2, "Parent2", false); this.radGridView1.DataSource = dt; ((GridViewCheckBoxColumn)this.radGridView1.MasterTemplate.Columns["IsActive"]).EnableHeaderCheckBox = true; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; DataTable childDataTable = new DataTable(); childDataTable.Columns.Add("Id", typeof(int)); childDataTable.Columns.Add("Title", typeof(string)); childDataTable.Columns.Add("ParentId", typeof(int)); childDataTable.Columns.Add("IsValid", typeof(bool)); childDataTable.Rows.Add(1, "Child 1", 1, false); childDataTable.Rows.Add(2, "Child 1", 1, false); childDataTable.Rows.Add(3, "Child 2", 2, false); childDataTable.Rows.Add(4, "Child 2", 2, false); GridViewTemplate template = new GridViewTemplate(); template.DataSource = childDataTable; ((GridViewCheckBoxColumn)template.Columns["IsValid"]).EnableHeaderCheckBox = true; radGridView1.MasterTemplate.Templates.Add(template); template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.RelationName = "MasterDeatial"; relation.ParentColumnNames.Add("Id"); relation.ChildColumnNames.Add("ParentId"); radGridView1.Relations.Add(relation);
The GridViewCheckBoxColumn.EditMode property controls when the value of the editor will be submitted to the cell. By default, the value is OnValidate and the value will be submitted only when the current cell changes, the grid looses focus or the active editor is closed by pressing Enter. If you set the EditMode property to OnValueChange it will submit the value immediately after the editor value changes. Please refer to the attached gif files illustrating the difference between the two modes. To reproduce: if you set the GridViewCheckBoxColumn.EnableHeaderCheckBox property to true, the cell value is always submitted immediately after toggle/untoggle the checkbox without considering that EditMode.OnValidate is used.
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn(); decimalColumn.Name = "DecimalColumn"; decimalColumn.HeaderText = "DecimalColumn"; this.radGridView1.MasterTemplate.Columns.Add(decimalColumn); GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.Name = "TextBoxColumn"; textBoxColumn.HeaderText = "TextBoxColumn"; this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn); GridViewDateTimeColumn dateTimeColumn = new GridViewDateTimeColumn(); dateTimeColumn.Name = "DateTimeColumn"; dateTimeColumn.HeaderText = "DateTimeColumn"; this.radGridView1.MasterTemplate.Columns.Add(dateTimeColumn); } } Workaround: this.radGridView1.MasterView.TableAddNewRow.MinHeight = 30;
When the EnableHeaderCheckBox property is set to true, whenever the checkbox is clicked in the new row, a new row is actually added to the grid before any other modifications are made. This can be replicated in the attached sample project. Run it and click the checkbox in the new row several times. Multiple rows are added. Workaround: cancel the RadGridView.UserAddingRow until all the required fields are filled.
To reproduce: public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Id"); dt.Columns.Add("Name"); for (int i = 0; i < 1; i++) { dt.Rows.Add(i, "Item"); } this.radGridView1.DataSource = dt; this.radGridView1.SelectionMode = GridViewSelectionMode.FullRowSelect; this.radGridView1.ClipboardCopyMode = Telerik.WinControls.UI.GridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText; this.radGridView1.MultiSelect = true; } private void button1_Click(object sender, EventArgs e) { this.radGridView1.SelectAll(); this.radGridView1.Copy(); } If you click the button, you will notice that only one cell is copied. However, if you add 2 and more rows, the whole grid content will be copied to the clipboard. Workaround: use the BeginRowCopy/EndRowCopy methods. private void button1_Click(object sender, EventArgs e) { this.radGridView1.SelectAll(); this.radGridView1.MasterTemplate.BeginRowCopy(); this.radGridView1.Copy(); this.radGridView1.MasterTemplate.EndRowCopy(); }
To reproduce: - Add several columns including combo-box columns to a grid. - Add one row and upon a button click, change the data source of the combo column. Workaround: Seth the following field to null prior changing the data source: GetType(GridViewComboBoxColumn).GetField("nullBoundItem", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).SetValue(combo, Nothing) combo.DataSource = dt
To reproduce: Sub New() InitializeComponent() Dim dt1 As New DataTable dt1.Columns.Add("Id", GetType(Integer)) dt1.Columns.Add("Name", GetType(String)) For index = 1 To 20 dt1.Rows.Add(index, "Parent" & index) Next Me.RadGridView1.MasterTemplate.DataSource = dt1 Me.RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill Dim dt2 As New DataTable dt2.Columns.Add("Id", GetType(Integer)) dt2.Columns.Add("Name", GetType(String)) dt2.Columns.Add("ParentId", GetType(Integer)) Dim dt3 As New DataTable dt3.Columns.Add("Id", GetType(Integer)) dt3.Columns.Add("Name", GetType(String)) dt3.Columns.Add("ParentId", GetType(Integer)) For index = 1 To 20 If index Mod 2 = 0 Then dt2.Rows.Add(index, "Child1." & index, index) If index Mod 4 = 0 Then dt3.Rows.Add(index, "Child2." & index, index) End If ElseIf index Mod 3 = 0 Then dt3.Rows.Add(index, "Child2." & index, index) Else dt3.Rows.Add(index, "Child2." & index, index) End If Next Dim template As New GridViewTemplate() template.DataSource = dt2 template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill RadGridView1.MasterTemplate.Templates.Add(template) Dim relation As New GridViewRelation(RadGridView1.MasterTemplate) relation.ChildTemplate = template relation.RelationName = "FirstChild" relation.ParentColumnNames.Add("Id") relation.ChildColumnNames.Add("ParentId") RadGridView1.Relations.Add(relation) Dim template2 As New GridViewTemplate() template2.DataSource = dt3 template2.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill RadGridView1.MasterTemplate.Templates.Add(template2) Dim relation2 As New GridViewRelation(RadGridView1.MasterTemplate) relation2.ChildTemplate = template2 relation2.RelationName = "SecondChild" relation2.ParentColumnNames.Add("Id") relation2.ChildColumnNames.Add("ParentId") RadGridView1.Relations.Add(relation2) AddHandler Me.RadGridView1.ChildViewExpanding, AddressOf ChildViewExpanding End Sub Private Sub RadGridView1_ViewCellFormatting(sender As Object, e As Telerik.WinControls.UI.CellFormattingEventArgs) _ Handles RadGridView1.ViewCellFormatting Dim cell As GridDetailViewCellElement = TryCast(e.CellElement, GridDetailViewCellElement) Dim expanderCell As GridGroupExpanderCellElement = TryCast(e.CellElement, GridGroupExpanderCellElement) If expanderCell IsNot Nothing AndAlso TypeOf e.CellElement.RowElement Is GridDataRowElement Then Dim hierarchyRow As GridViewHierarchyRowInfo = DirectCast(expanderCell.RowInfo, GridViewHierarchyRowInfo) If Not IsExpandable(hierarchyRow) Then expanderCell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Hidden Else expanderCell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Visible End If ElseIf cell IsNot Nothing Then Dim hierarchyRow As GridViewHierarchyRowInfo = DirectCast(DirectCast(cell.RowInfo, GridViewDetailsRowInfo).Owner, _ GridViewHierarchyRowInfo) For i As Integer = 0 To cell.PageViewElement.Items.Count - 1 Dim item As RadPageViewItem = cell.PageViewElement.Items(i) Dim viewInfo As GridViewInfo = hierarchyRow.Views(i) item.Text = "Child Template " & i If viewInfo.ChildRows.Count = 0 Then If i = 0 AndAlso i < cell.PageViewElement.Items.Count - 1 Then cell.PageViewElement.Items(i + 1).IsSelected = True End If item.Visibility = Telerik.WinControls.ElementVisibility.Hidden Else item.Visibility = Telerik.WinControls.ElementVisibility.Visible End If Next End If End Sub Private Function IsExpandable(hierarchyRow As GridViewHierarchyRowInfo) As Boolean For Each view As GridViewInfo In hierarchyRow.Views If view.ChildRows.Count > 0 Then Return True End If Next Return False End Function Workaround: AddHandler Me.RadGridView1.ChildViewExpanding, AddressOf RadGridView1_ChildViewExpanding AddHandler Me.RadGridView1.MouseDown, AddressOf RadGridView_MouseDown Private Sub RadGridView1_ChildViewExpanding(sender As Object, e As ChildViewExpandingEventArgs) If lastClicked IsNot Nothing AndAlso e.ParentRow.Equals(lastClicked) Then e.Cancel = False Else e.Cancel = True End If End Sub Dim lastClicked As GridViewRowInfo Private Sub RadGridView_MouseDown(sender As Object, e As MouseEventArgs) Dim expander As GridExpanderItem = TryCast(Me.RadGridView1.ElementTree.GetElementAtPoint(e.Location), GridExpanderItem) If expander IsNot Nothing Then lastClicked = DirectCast(expander.Parent, GridGroupExpanderCellElement).RowInfo End If End Sub
To reproduce: - Add GridViewTextBoxColumn and set the MaxLength property. - Paste in data row while the is not in edit mode. Workaround: private void RadGridView1_Pasting(object sender, Telerik.WinControls.UI.GridViewClipboardEventArgs e) { if (radGridView1.CurrentColumn.Name == "column1") { GridViewTextBoxColumn col = new GridViewTextBoxColumn(); var lenght = col.MaxLength; if (Clipboard.ContainsData(DataFormats.Text)) { e.Cancel = true; string data = Clipboard.GetData(DataFormats.Text).ToString(); radGridView1.CurrentCell.Value = data.Substring(0, lenght); } } }
To reproduce: Sub New() InitializeComponent() Dim dt As New DataTable dt.Columns.Add("Id", GetType(Integer)) dt.Columns.Add("Name", GetType(String)) dt.Columns.Add("Description", GetType(String)) For index = 1 To 5 dt.Rows.Add(index, "Item" & index, "Description" & index) Next Me.RadGridView1.DataSource = dt Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill AddHandler Me.RadGridView1.UserAddingRow, AddressOf UserAddingRow End Sub Private Sub UserAddingRow(sender As Object, e As Telerik.WinControls.UI.GridViewRowCancelEventArgs) Me.RadGridView1.MasterView.TableAddNewRow.ErrorText = "" If String.IsNullOrEmpty(e.Rows(0).Cells(0).Value) Then e.Cancel = True Me.RadGridView1.MasterView.TableAddNewRow.ErrorText = "Empty value is not allowed!" End If End Sub 1. Click the new row and enter a value in the last cell. 2. Click outside the new row, e.g. click on a data row. The UserAddingRow event is canceled and the new row remains current. 3. Click a data row again without any modification on the new row. The new row is not current anymore. 4. However, you perform step 1and 2 but instead of clicking a data row, the user clicks a header cell, the new row is not current from the first time. It is necessary to forbid the user to exit the new row until the validation passes or the new row is canceled by pressing Enter. Workaround: use the CellValidating/RowValidating event for validating.
Workaround: create a custom GridDetailViewCellElement Public Class Form1 Sub New() InitializeComponent() AddHandler dgvPatients.CreateCell, AddressOf dgvPatients_CreateCell End Sub Private Sub dgvPatients_CreateCell(sender As Object, e As GridViewCreateCellEventArgs) If e.CellType = GetType(GridDetailViewCellElement) Then e.CellElement = New MyGridDetailViewCellElement(e.Column, e.Row) End If End Sub End Class Public Class MyGridDetailViewCellElement Inherits GridDetailViewCellElement Sub New(column As GridViewColumn, rowElement As GridRowElement) MyBase.New(column, rowElement) End Sub Public Overrides Sub UpdateTabItemsVisibility() If Me.DetailsRow Is Nothing Then Return End If MyBase.UpdateTabItemsVisibility() End Sub End Class
To reproduce: GridViewTextBoxColumn textBoxColumn1 = new GridViewTextBoxColumn("Col 1"); textBoxColumn1.FieldName = "col1"; radGridView1.MasterTemplate.Columns.Add(textBoxColumn1); GridViewTextBoxColumn textBoxColumn2 = new GridViewTextBoxColumn("Col 2"); textBoxColumn2.FieldName = "col2"; textBoxColumn2.FormatString = "{0:d}"; radGridView1.MasterTemplate.Columns.Add(textBoxColumn2); radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; DataTable dt = new DataTable(); dt.Columns.Add("col1", typeof(string)); dt.Columns.Add("col2", typeof(DateTime)); for (int i = 0; i < 10; i++) { dt.Rows.Add("Item" + i, DateTime.Now.AddDays(i)); } this.radGridView1.AutoGenerateColumns = false; this.radGridView1.DataSource = dt; Right click the row header cell and select Copy. The following exception occurs although we don't have a GridViewDateTimeColumn : System.InvalidCastException was unhandled HResult=-2147467262 Message=Unable to cast object of type 'Telerik.WinControls.UI.GridViewTextBoxColumn' to type 'Telerik.WinControls.UI.GridViewDateTimeColumn'. Source=Telerik.WinControls.GridView StackTrace: at Telerik.WinControls.UI.MasterGridViewTemplate.CopyRows(String format, Boolean cut, Boolean cutOperation, StringBuilder content) at Telerik.WinControls.UI.MasterGridViewTemplate.ProcessContent(String format, Boolean cut, Boolean cutOperation) at Telerik.WinControls.UI.MasterGridViewTemplate.CopyContent(Boolean cut) at Telerik.WinControls.UI.MasterGridViewTemplate.Copy() at Telerik.WinControls.UI.GridDataRowElement.copyItem_Click(Object sender, EventArgs e) at Telerik.WinControls.RadElement.OnClick(EventArgs e) at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e) at Telerik.WinControls.UI.RadMenuItem.OnClick(EventArgs e) at Telerik.WinControls.RadElement.DoClick(EventArgs e) at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e) at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e) at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at Telerik.WinControls.RadControl.WndProc(Message& m) at Telerik.WinControls.UI.RadPopupControlBase.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at _1075342CopyText.Program.Main() in d:\Projects\1075342CopyText_Binding\Program.cs:line 17 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: Workaround: use a GridViewDateTimeColumn
Please refer to the attached sample project and select a new value in the drop down. Workaround: change the PageSize in the RadDropDownListElement.PopupClosed event: public sealed class PageSizeDropdownHeaderCellElement : GridHeaderCellElement { public PageSizeDropdownHeaderCellElement(GridViewColumn col, GridRowElement row) : base(col, row) { TextAlignment = ContentAlignment.TopCenter; Alignment = ContentAlignment.TopCenter; } private RadDropDownListElement _dropDownListElement; protected override void CreateChildElements() { base.CreateChildElements(); _dropDownListElement = new RadDropDownListElement(); if (_dropDownListElement != null && _dropDownListElement.DataSource == null) { _dropDownListElement = new RadDropDownListElement(); _dropDownListElement.BindingContext = new BindingContext(); _dropDownListElement.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList; _dropDownListElement.Items.Clear(); _dropDownListElement.Items.Add(new RadListDataItem("10", 10) { Selected = true }); _dropDownListElement.Items.Add(new RadListDataItem("25", 25)); _dropDownListElement.Items.Add(new RadListDataItem("50", 50)); _dropDownListElement.Items.Add(new RadListDataItem("100", 100)); _dropDownListElement.Items.Add(new RadListDataItem("All", -1)); _dropDownListElement.Margin = new Padding(15, 0, 0, 0); _dropDownListElement.StretchHorizontally = true; _dropDownListElement.NotifyParentOnMouseInput = false; _dropDownListElement.Popup.MouseClick += Popup_MouseClick; _dropDownListElement.PopupClosed += _dropDownListElement_PopupClosed; this.Children.Add(_dropDownListElement); } } RadListVisualItem elementUnderMouse; private void Popup_MouseClick(object sender, MouseEventArgs e) { elementUnderMouse = _dropDownListElement.Popup.ElementTree.GetElementAtPoint(e.Location) as RadListVisualItem; } private void _dropDownListElement_PopupClosed(object sender, RadPopupClosedEventArgs args) { if (elementUnderMouse == null) { return; } if (_dropDownListElement.SelectedIndex == -1) return; var pageSize = Convert.ToInt32(elementUnderMouse.Data.Value); if (pageSize == -1) { pageSize = GridControl.RowCount; } else { pageSize = pageSize <= GridControl.RowCount ? pageSize : GridControl.RowCount; } this.RowInfo.Tag = pageSize; GridControl.PageSize = pageSize; elementUnderMouse = null; } protected override void SetContentCore(object value) { if (_dropDownListElement != null && this.RowInfo.Tag != null) { this._dropDownListElement.SelectedValue = (int)this.RowInfo.Tag; } } public override bool IsCompatible(GridViewColumn data, object context) { return data is ActionColumn && context is GridTableHeaderRowElement; } protected override Type ThemeEffectiveType { get { return typeof(GridHeaderCellElement); } } }
To reproduce: - Subscribe to the CellClick event - Click several times in the grid with the right mouse button. - At some point, the CellClick event will be executed. Workaround: - Use the Click event: private void RadGridView1_Click(object sender, EventArgs e) { var args = e as MouseEventArgs; if (args.Button == MouseButtons.Left) { var clickedCell = radGridView1.ElementTree.GetElementAtPoint(args.Location) as GridDataCellElement; if (clickedCell != null) { //add your code here } } }
To reproduce: - Add one-to-many relations hierarchy 3 or more child templates. - Export the grid using GridViewSpreadExport - The child rows of the last parent row are missing. Workaround: Add an empty parent row at the end of the grid.
To reproduce: - Bind the grid to an object that contains enum property. - Save the layout - Restart the application and load the layout before setting the DataSource of the grid. Workaround: Load the layout after the DataSource is set.
Description: if you filter a text column with "Does not contains" operator, the produced FilterDescriptors.Expression is "ProductName NOT LIKE '%c%' OR ProductName IS NULL". However, if you try to programmatically add this expression to the RadGridView.FilterDescriptors.Expression property it doesn't filter the grid. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.ProductsTableAdapter.Fill(Me.NwindDataSet.Products) Me.RadGridView1.EnableFiltering = True End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Me.RadGridView1.FilterDescriptors.Expression = "ProductName NOT LIKE '%c%' OR ProductName IS NULL" End Sub Workaround: don't set expression but add a FilterDescriptor: http://docs.telerik.com/devtools/winforms/gridview/filtering/setting-filters-programmatically-(simple-descriptors) Dim filter1 As New FilterDescriptor() filter1.[Operator] = FilterOperator.NotContains filter1.Value = "c" filter1.IsFilterEditor = True filter1.PropertyName = "ProductName" Me.RadGridView1.FilterDescriptors.Add(filter1)
To reproduce: populate a grid and enable multiple selection. Use cell selection. When you click the row header, the entire row (all cells from the row) is selected no matter the SelectionMode. However, if you start a selection from the row header and move the cursor, only the cells from the first column get selected. The attached gif file illustrates the behavior. The expected behavior is that all cells from the affected columns should be selected when starting the selection from the row header. Workaround: Sub New() InitializeComponent() Me.RadGridView1.MultiSelect = True Me.RadGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect AddHandler Me.RadGridView1.MouseDown, AddressOf GridMouseDown AddHandler Me.RadGridView1.MouseUp, AddressOf GridMouseUp AddHandler Me.RadGridView1.MouseMove, AddressOf GridMouseMove End Sub Dim isMouseDown = False Dim startRow As GridViewRowInfo Dim lastHoveredCell As GridCellElement Private Sub GridMouseDown(sender As Object, e As MouseEventArgs) Dim cell As GridRowHeaderCellElement = TryCast(Me.RadGridView1.ElementTree.GetElementAtPoint(e.Location), GridRowHeaderCellElement) If cell IsNot Nothing Then isMouseDown = True startRow = cell.RowInfo End If End Sub Private Sub GridMouseUp(sender As Object, e As MouseEventArgs) isMouseDown = False startRow = Nothing End Sub Private Sub GridMouseMove(sender As Object, e As MouseEventArgs) If isMouseDown Then Dim cellUnderMouse As GridCellElement = TryCast(Me.RadGridView1.ElementTree.GetElementAtPoint(e.Location), GridCellElement) If cellUnderMouse IsNot Nothing AndAlso Not cellUnderMouse.Equals(lastHoveredCell) Then lastHoveredCell = cellUnderMouse Me.RadGridView1.ClearSelection() Me.RadGridView1.SelectedCells.BeginUpdate() If startRow.Index > cellUnderMouse.RowInfo.Index Then For index = cellUnderMouse.RowInfo.Index To startRow.Index Me.RadGridView1.Rows(index).IsSelected = True Next Else For index = startRow.Index To cellUnderMouse.RowInfo.Index For Each cell As GridViewCellInfo In Me.RadGridView1.Rows(index).Cells cell.IsSelected = True Next Next End If Me.RadGridView1.SelectedCells.EndUpdate(True) End If End If End Sub
To reproduce: populate the grid with data and use the following code snippet: Me.RadGridView1.EnableAlternatingRowColor = True Me.RadGridView1.TableElement.AlternatingRowColor = Color.LightGray Me.RadGridView1.MultiSelect = True Me.RadGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect Select multiple cells from different rows. You will notice that alternating color is not applied to the rows for which you have a selected cell. The attached gif file illustrates the behavior. Workaround: Sub New() InitializeComponent() Me.RadGridView1.MultiSelect = True Me.RadGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect End Sub Private Sub RadGridView1_CellFormatting(sender As Object, e As Telerik.WinControls.UI.CellFormattingEventArgs) _ Handles RadGridView1.CellFormatting e.CellElement.DrawFill = True e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid If e.CellElement.IsSelected Then e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local) ElseIf e.CellElement.RowInfo.Index Mod 2 = 0 Then e.CellElement.BackColor = Color.White Else e.CellElement.BackColor = Color.LightGray End If End Sub
Please refer to the attached gif file illustrating how to reproduce the error with the Demo application. Workaround: this.radGridView1.UseScrollbarsInHierarchy = true;