To reproduce: - Crete a self-reference hiearchy and show the grid lines. - Start the application expand some rows scroll to the bottom and then scroll to the right. - The issue is easily reproducible with the example from the documentation. Workaround: class MyDataCellElement : GridDataCellElement { public MyDataCellElement(GridViewColumn col, GridRowElement row) : base(col, row) { } protected override SizeF ArrangeOverride(SizeF finalSize) { SelfReferenceCellLayout selfReferenceLayout = this.SelfReferenceLayout; if (selfReferenceLayout != null) { GridDataRowElement dataRowElement = this.RowElement as GridDataRowElement; if (dataRowElement != null && this.ColumnInfo.OwnerTemplate != null) { dataRowElement.SelfReferenceLayout.StackLayoutElement.Visibility = ElementVisibility.Visible; } } else { GridDataRowElement dataRowElement = this.RowElement as GridDataRowElement; if (dataRowElement != null && this.ColumnInfo.OwnerTemplate != null) { dataRowElement.SelfReferenceLayout.StackLayoutElement.Visibility = ElementVisibility.Collapsed; } } return base.ArrangeOverride(finalSize); } protected override Type ThemeEffectiveType { get { return typeof(GridDataCellElement); } } }
To reproduce: public Form1() { InitializeComponent(); List<Item> items = new List<Item>(); for (int i = 1; i <= 10; i++) { items.Add(new Item(i, "Product" + i, 0.25m * i, i)); } this.radGridView1.DataSource = items; GridViewDecimalColumn col = new GridViewDecimalColumn("Calculated Column"); col.Expression = "Quantity*Price/100"; this.radGridView1.Columns.Add(col); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; } public class Item { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public int Quantity { get; set; } public Item(int id, string name, decimal price, int quantity) { this.Id = id; this.Name = name; this.Price = price; this.Quantity = quantity; } } MemoryStream s = new MemoryStream(); private void radButton1_Click(object sender, EventArgs e) { s = new MemoryStream(); this.radGridView1.SaveLayout(s); } private void radButton2_Click(object sender, EventArgs e) { this.radGridView1.LoadLayout(s); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { s.Close(); } Workaround: before loading the layout, clear the columns
Workaround: public Form1() { InitializeComponent(); this.radGridView1.TableElement.VScrollBar.ValueChanged += VScrollBar_ValueChanged; } private void VScrollBar_ValueChanged(object sender, EventArgs e) { int maxValue = this.radGridView1.TableElement.VScrollBar.Maximum - this.radGridView1.TableElement.VScrollBar.LargeChange; if (maxValue < 0) { this.radGridView1.TableElement.VScrollBar.Value = 0; } else if (this.radGridView1.TableElement.VScrollBar.Value > maxValue) { this.radGridView1.TableElement.VScrollBar.Value = maxValue; } }
To reproduce: 1.Set the GridView template's ViewDefinition to ColumnGroups 2.Add a new column 3.Delete the column 4.Add another new column. The PropertyBuilder closes and it is not possible to open the Smart Tag of RadGridView anymore. Please refer to the attached gif file. Workaround: The issue is caused by a remaining reference to a deleted column. When using the RadGridView PropertyBuilder and a column is added to ColumnGroupsViewDefinition, once the column is deleted from RadGridView (via the Property Builder) the code for adding the column in the ColumnGroupsViewDefinition remains, and this causes further designer instability with the Property Builder. To handle this scenario there are two options: 1. When a column is deleted via Property Builder, and this column was part of ColumnGroupsViewDefinition, open the Designer.cs/vb file, locate the line that adds this column to a ColumnNames collection and delete it. It should be something like: gridViewColumnGroupRow3.ColumnNames.Add("column1"); - where "column1" is the name of the deleted column 2. Instead of using the Property Builder to build the ColumnGroupsViewDefinition, build it programmatically.
To reproduce: public Form1() { InitializeComponent(); for (int i = 0; i < 10; i++) { this.radGridView1.Columns.Add("Col"+i); } this.radGridView1.TableElement.RowDragHint = null; } Workaround: public Form1() { InitializeComponent(); for (int i = 0; i < 10; i++) { this.radGridView1.Columns.Add("Col"+i); } this.radGridView1.TableElement.RowDragHint = null; CustomRadGridViewDragDropService service = new CustomRadGridViewDragDropService(this.radGridView1.GridViewElement); this.radGridView1.GridViewElement.RegisterService(service); } public class CustomRadGridViewDragDropService : RadGridViewDragDropService { public CustomRadGridViewDragDropService(RadGridViewElement gridViewElement) : base(gridViewElement) { } public override string Name { get { return typeof(RadGridViewDragDropService).Name; } } protected override void PrepareDragHint(ISupportDrop dropTarget) { if (this.GridViewElement.TableElement.RowDragHint == null) { return; } base.PrepareDragHint(dropTarget); } protected override IGridDragDropBehavior GetDragDropBehavior() { IGridDragDropBehavior behavior = null; ISupportDrop dropTarget = this.DropTarget; if (dropTarget is GridHeaderCellElement) { behavior = new CustomGridColumnDragDropBehvavior(); return behavior; } return base.GetDragDropBehavior(); } } public class CustomGridColumnDragDropBehvavior : GridColumnDragDropBehvavior { public override Size GetDragHintSize(ISupportDrop dropTarget) { if (this.DragHint==null) { return new Size(0, 0); } return base.GetDragHintSize(dropTarget); } }
Workaround: skip the summary rows by creating custom GridViewSearchRowInfo: private void radGridView1_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e) { if (e.RowInfo is GridViewSearchRowInfo) { e.RowInfo = new CustomGridViewSearchRowInfo(e.ViewInfo); } } public class CustomGridViewSearchRowInfo : GridViewSearchRowInfo { public CustomGridViewSearchRowInfo(GridViewInfo viewInfo) : base(viewInfo) { } protected override bool MatchesSearchCriteria(string searchCriteria, GridViewRowInfo row, GridViewColumn col) { if (row is GridViewSummaryRowInfo) { return false; } return base.MatchesSearchCriteria(searchCriteria, row, col); } }
All event handlers should be made virtual. All controls should be public or have properties.
To reproduce: run the attached sample project. Workaround: set the AutoSizeRows property to false before exporting and set it back to true after the export is completed.
WORKAROUND: 1. Create a custom GridTableElement and override the ProcessColumnEvent method. 2. Create a custom TableViewDefinition and override the CreateViewUIElement to return the custom table element. 3. Assign the custom view definition to the grid's ViewDefinition property public class CustomGridTableElement : GridTableElement { protected override GridViewEventResult ProcessColumnEvent(GridViewColumn column, GridViewEvent eventData) { if (eventData.Info.Id == KnownEvents.PropertyChanged) { RadPropertyChangedEventArgs args = eventData.Arguments[0] as RadPropertyChangedEventArgs; if (args.Property == GridViewColumn.IsVisibleProperty) { ViewElement.UpdateRowsWhenColumnsChanged(); if (this.GridViewElement.AutoSizeRows) { foreach (GridViewRowInfo row in this.ViewTemplate.Rows) { row.Height = -1; } this.UpdateLayout(); this.RowScroller.UpdateScrollRange(); } return null; } } return base.ProcessColumnEvent(column, eventData); } protected override Type ThemeEffectiveType { get { return typeof(GridTableElement); } } } public class CustomTableViewDefinition : TableViewDefinition { public override IRowView CreateViewUIElement(GridViewInfo viewInfo) { return new CustomGridTableElement(); } } this.radGridView1.ViewDefinition = new CustomTableViewDefinition();
To reproduce: DataTable dt = new DataTable(); public Form1() { InitializeComponent(); dt.Columns.Add("Id"); dt.Columns.Add("Name"); dt.Columns.Add("Type"); for (int i = 0; i < 30; i++) { dt.Rows.Add(i, "Item" + i, "Type" + i % 2); } this.radGridView1.DataSource = dt; this.radGridView1.AutoExpandGroups = true; GroupDescriptor descriptor = new GroupDescriptor(); descriptor.GroupNames.Add("Type", ListSortDirection.Ascending); this.radGridView1.GroupDescriptors.Add(descriptor); } private void button1_Click(object sender, EventArgs e) { dt.Rows.Add(30, "Item30", "Type3"); } Workaround: set the AutoExpandGroups property to false and manually expand the groups when a new row is added.
To reproduce: populate the grid with data and use the code snippet below: public Form1() { InitializeComponent(); this.radGridView1.EnablePaging = true; this.radGridView1.AddNewRowPosition = Telerik.WinControls.UI.SystemRowPosition.Bottom; } Select the third page and click the new row at the bottom. The editor is activated as expected but the first page is made current. Workaround: use the CellEditorInitialized event and move to the desired page private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { if (e.Row is GridViewNewRowInfo) { this.radGridView1.MasterTemplate.MoveToPage(2); } }
Please refer to the attached sample project.
When you set a RadGridView's SelectionMode to GridViewSelectionMode.CellSelect and then you highlight full rows by using the row header, the SelectedRows collection is empty. Telerik support informed me this is "as expected" and that I should use "SelectedCells" collection when using the CellSelect Mode. While this is a decent workaround I don't see why SelectedRows collection can't be filled when the entire row is actually highlighted.
To reproduce: public RadForm1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Id"); dt.Columns.Add("Name"); for (int i = 0; i < 50; i++) { dt.Rows.Add(i, "Data" + i); } this.radGridView1.DataSource = dt; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.AutoSizeRows = false; } private void RadForm1_Load(object sender, EventArgs e) { this.radGridView1.Rows[5].MinHeight = 80; this.radGridView1.Rows[5].MaxHeight = 100; } The Min/MaxHeight is not respected even when resizing the row. Workaround: set the Height property.
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: - 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.
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