To reproduce: Dim dockmem As New MemoryStream Dim gridmem As New MemoryStream Public Sub SetData() ' dgvSelectList.DataSource = Nothing Dim dt As DataTable dt = New DataTable dt.Columns.Add("VENDCODE") dt.Columns.Add("VENDNAME") dt.Rows.Add("AA2", "Arthur") dt.Rows.Add("AA2", "Arthur") dgvSelectList.DataSource = dt dgvSelectList.BestFitColumns() End Sub Private Sub frmSelectListNG2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load SetData() dgvSelectList.EnableFiltering = False 'Save Grid and Dock layout settings to mem stream and simulate my process SaveSettings() End Sub Public Sub btnGO_Click(sender As System.Object, e As System.EventArgs) Handles btnGO.Click LoadSettings() dgvSelectList.SplitMode = RadGridViewSplitMode.Horizontal SetData() LoadSettings() End Sub Private Sub LoadSettings() gridmem.Position = 0 dockmem.Position = 0 dgvSelectList.LoadLayout(gridmem) rdkSelect.LoadFromXml(dockmem) End Sub Private Sub SaveSettings() gridmem.Position = 0 dockmem.Position = 0 dgvSelectList.SaveLayout(gridmem) rdkSelect.SaveToXml(dockmem) End Sub Workaround - set the datasource to Nothing prior rebinding
Advanced Property Grid in Property Builder filter the data source list and not show 'Project Data Sources' for selection in the DataSource popup. There is a difference in the drop down Datasource selection between the : GridviewDataColumn Collection Editor and the... RadGridView Property Builder
To reproduce: 1.Add a GridViewCheckBoxColumn and populate the grid with data: radGridView1.DataSource = Enumerable.Range(1, 100).Select(i => new { Check = i % 2 == 0}); 2.Add a RadButton and on its Click event clear the filters: private void radButton1_Click(object sender, EventArgs e) { radGridView1.MasterTemplate.FilterDescriptors.Clear(); } 3.Run the application and change the filter to show only checked items. Then click the button. The check box in the filtering row for GridViewCheckBoxColumn was not updated properly. Workaround: this.radGridView1.BeginUpdate(); radGridView1.MasterTemplate.FilterDescriptors.Clear(); this.radGridView1.EndUpdate();
Workaround: public Form1() { InitializeComponent(); radGridView1.CreateCell += radGridView1_CreateCell; } private void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e) { if (e.CellType == typeof(GridDataCellElement)) { e.CellElement = new CustomDataCell(e.Column,e.Row); } } public class CustomDataCell : GridDataCellElement { public CustomDataCell(GridViewColumn column, GridRowElement row) : base(column, row) { } protected override Type ThemeEffectiveType { get { return typeof(GridDataCellElement); } } protected override void OnMouseDown(MouseEventArgs e) { if (e.Button == MouseButtons.Left && this.AllowRowReorder && this.ViewTemplate.AllowRowReorder && Cursor.Current != Cursors.SizeNS) { base.OnMouseDown(e); } } }
The example found here http://www.telerik.com/support/kb/winforms/gridview/details/high-performance-with-radgridview-and-virtual-mode-including-filtering-sorting-and-grouping, currently does not work. There should be a way for the example virtual grid to go past the current limitation in sorting, filtering and grouping.
How to reproduce: just create a grid with a great number of rows e.g. 15000 and scroll down using the page down key Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridDataRowBehavior()); DataTable dataTable = new DataTable(); dataTable.Columns.Add("Id", typeof(int)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("IsValid", typeof(bool)); for (int i = 0; i < 14000; i++) { dataTable.Rows.Add(i, "Name " + i, i % 2 == 0 ? true : false); } this.radGridView1.DataSource = dataTable; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; } } public class CustomGridDataRowBehavior : GridDataRowBehavior { protected override bool ProcessPageUpKey(KeyEventArgs keys) { GridTableElement tableElement = (GridTableElement)this.GridViewElement.CurrentView; int index = this.GridViewElement.CurrentRow.Index - tableElement.RowsPerPage + 1; if (index < 0) { index = 0; } GridViewRowInfo firstScrollableRow = this.GridControl.Rows[index]; this.GridViewElement.CurrentRow = firstScrollableRow; return true; } protected override bool ProcessPageDownKey(KeyEventArgs keys) { GridTableElement tableElement = (GridTableElement)this.GridViewElement.CurrentView; int index = this.GridViewElement.CurrentRow.Index + tableElement.RowsPerPage - 1; if (index > this.GridControl.Rows.Count - 1) { index = this.GridControl.Rows.Count - 1; } GridViewRowInfo lastScrollableRow = this.GridControl.Rows[index]; this.GridViewElement.CurrentRow = lastScrollableRow; return true; } }
To reproduce: create a form with a button on it where on its Click event you show another form with the following code snippet: public class Dummy { public int ID { get; set; } public string Description { get; set; } } public Form1() { InitializeComponent(); this.radGridView1.FilterChanged += radGridView1_FilterChanged; if (File.Exists(@"..\..\..\layout.xml")) { this.radGridView1.LoadLayout(@"..\..\..\layout.xml"); } else { radGridView1.Columns.Add(new GridViewTextBoxColumn { HeaderText = "Id ", FieldName = "ID" }); radGridView1.Columns.Add(new GridViewTextBoxColumn { HeaderText = "Description", FieldName = "DESCRIPTION" }); } radGridView1.EnableFiltering = true; radGridView1.MasterTemplate.ShowHeaderCellButtons = true; radGridView1.MasterTemplate.ShowFilteringRow = true; var items = new List<Dummy>(); for (int i = 0; i < 20; i++) { var dummy = new Dummy { ID = i, Description = string.Format("Description_{0}", i) }; items.Add(dummy); } radGridView1.AutoGenerateColumns = false; radGridView1.DataSource = items; } private void radGridView1_FilterChanged(object sender, GridViewCollectionChangedEventArgs e) { this.radGridView1.SaveLayout(@"..\..\..\layout.xml"); } Please refer to the attached gif file illustrating the steps.
To reproduce: 1. Use the following code: private void Form1_Load(object sender, EventArgs e) { this.customersTableAdapter.Fill(this.nwindDataSet.Customers); this.radGridView1.DataSource = customersBindingSource; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.CellEndEdit += radGridView1_CellEndEdit; this.radGridView1.AutoSizeRows = true; SortDescriptor descriptor = new SortDescriptor(); descriptor.PropertyName = "Country"; descriptor.Direction = ListSortDirection.Ascending; this.radGridView1.MasterTemplate.SortDescriptors.Add(descriptor); } void radGridView1_CellEndEdit(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { int selectedRowIndex = this.radGridView1.ChildRows.IndexOf(this.radGridView1.CurrentRow); this.radGridView1.TableElement.ScrollToRow(selectedRowIndex); } 2. Modify cell value in the sorted column. After the editor value is confirmed by pressing Enter, you scroll to the current column. However, you do not observe the expected behavior. Workaround: set the AutoSizeRows property to false.
To reproduce: radGridView1.TableElement.ColumnScroller.ScrollMode = ItemScrollerScrollModes.Discrete; Workaround: radGridView1.TableElement.HScrollBar.MouseUp += RadGridView1_HScrollBarMouseUp; private void RadGridView1_HScrollBarMouseUp(object sender, MouseEventArgs e) { int ixCol = GetLeftCol(radGridView1); Debug.WriteLine( "Index = "+ ixCol); if (ixCol > -1) { radGridView1.TableElement.ScrollToColumn(ixCol); radGridView1.Rows[0].Cells[ixCol].EnsureVisible(); } } private int currentLeftColumnIndex = 0; private int lastScrollPos = 0; public int GetLeftCol(RadGridView grd) { try { if (!grd.Columns.Any()) return -1; if (!grd.TableElement.VisualRows.Any()) return -1; if (grd.TableElement.ColumnScroller.Scrollbar.Value == 0) return -1; GridRowElement firstVisualRow = grd.TableElement.VisualRows.Where(r => r is Telerik.WinControls.UI.GridDataRowElement).First(); GridCellElement firstVisualCell = firstVisualRow.VisualCells.Where(c => c is Telerik.WinControls.UI.GridDataCellElement).First(); GridCellElement lastVisualCell = firstVisualRow.VisualCells.Where(c => c is Telerik.WinControls.UI.GridDataCellElement).Last(); if (grd.TableElement.ColumnScroller.Scrollbar.Value > lastScrollPos) { //"Scrolling Right" if (lastVisualCell.ColumnIndex == grd.Columns.Last().Index) { lastScrollPos = grd.TableElement.ColumnScroller.Scrollbar.Value; return -1; } if (currentLeftColumnIndex == firstVisualCell.ColumnIndex) { currentLeftColumnIndex += 1; } else { currentLeftColumnIndex = firstVisualCell.ColumnIndex < grd.Columns.Count ? firstVisualCell.ColumnIndex : grd.Columns.Count - 1; } lastScrollPos = grd.TableElement.ColumnScroller.Scrollbar.Value + 1; } else { currentLeftColumnIndex = firstVisualCell.ColumnIndex; lastScrollPos = grd.TableElement.ColumnScroller.Scrollbar.Value - 1; } return currentLeftColumnIndex; } catch (Exception ex) { return -1; } }
The columns are not re sized proportionally when the RadGridView is re sized in auto-size column mode fill.
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: Open the examples and navigate to GridView -> RightToLeft and toggle on RightToLeft. You will see that the GridGroupHeaderRowElements will have its text LeftToRight. Workaround: Use ViewCellFormatting: private void Grid_ViewCellFormatting15(object sender, CellFormattingEventArgs e) { if (e.CellElement.RowElement is GridGroupHeaderRowElement && e.CellElement.RowElement.Children.Any() && e.CellElement.RowElement.Children.Last() is GridGroupContentCellElement) { (e.CellElement.RowElement.Children.Last() as GridGroupContentCellElement).TextAlignment = System.Drawing.ContentAlignment.MiddleRight; } }
Currently, in order to display the "Deleter Row" context menu item, you should set both properties, AllowEditRow and AllowDeleteRow, to true. However, if you use the Delete key, it will remove the row if only the AllowDeleteRow property is set to true.
To reproduce: - Remove the new row from the grid. - Start the application and delete all rows. - When the last row is deleted the SelectionChanged does not fire. Workaround: - Use the UserDeletedRow event instead.
To reproduce: public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Col@", typeof(string)); dt.Rows.Add("Unit"); this.radGridView1.DataSource = dt; this.radGridView1.EnableFiltering = true; this.radGridView1.BestFitColumns(); } Workaround: modify the Name of each column in order to remove the "@" symbol: foreach (GridViewColumn c in this.radGridView1.Columns) { c.Name = c.Name.Replace("@", ""); }
If you select a row and click with the right mouse button on the header row column, the context menu with Cut, Copy, Paste is shown. If you click the Cut item, it will cut only a single cell. However, if you Copy , the entire row will be copied. Workaround: public class CustomGrid : RadGridView { protected override RadGridViewElement CreateGridViewElement( { return new CustomRadGridViewElement(); } public override string ThemeClassName { get { return typeof(RadGridView).FullName; } } } public class CustomRadGridViewElement : RadGridViewElement { protected override MasterGridViewTemplate CreateTemplate() { return new CustomMasterGridViewTemplate(); } protected override Type ThemeEffectiveType { get { return typeof(RadGridViewElement); } } } public class CustomMasterGridViewTemplate : MasterGridViewTempla { public override void Cut() { this.BeginRowCopy(); this.Copy(); this.EndRowCopy(); foreach (GridViewRowInfo row in this.SelectedRows) { foreach (GridViewCellInfo cell in row.Cells) { cell.Value = null; } } } }
To reproduce: 1.Add a grid and populate it with data. 2.Apply a theme to the entire application, e.g. TelerikMetro 3.Activate the grid editor. 4.Change the theme to VisualStudio2012Dark or HigthContrastBlack. 5.Activate the grid editor again. You will notice that editor's back color remains white and you are not able to read the text. Note: if you apply initially VisualStudio2012Dark theme, editor's back color is correct. Please refer to the attached gif file, illustrating this incorrect style. Workaround: private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { BaseGridEditor gridEditor = e.ActiveEditor as BaseGridEditor; if (gridEditor != null) { RadTextBoxElement el = gridEditor.OwnerElement.FindDescendant<RadTextBoxElement>(); if (el != null) { if (ThemeResolutionService.ApplicationThemeName == "VisualStudio2012Dark") { el.BackColor = Color.Black; } } } }
To reproduce: use the following code snippet and click the button twice. private DataTable GetTable01() { DataTable table = new DataTable(); table.Columns.Add("Dosage", typeof(int)); table.Columns.Add("Drug", typeof(string)); table.Columns.Add("Patient", typeof(string)); table.Columns.Add("Date", typeof(DateTime)); // Here we add five DataRows. table.Rows.Add(25, "Indocin", "David", DateTime.Now); table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now); table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now); table.Rows.Add(21, "Combivent", "Janet", DateTime.Now); table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now); return table; } private void button1_Click_1(object sender, EventArgs e) { DataTable table01 = GetTable01(); radGridView1.Rows.Clear(); radGridView1.DataSource = table01; } WORKAROUND I: this.radGridView1.DataError += radGridView1_DataError; private void radGridView1_DataError(object sender, GridViewDataErrorEventArgs e) { if (e.Exception is ArgumentException && e.Exception.Message == "Cannot clear this list.") { this.radGridView1.BeginUpdate(); while (this.radGridView1.Rows.Count > 0) { this.radGridView1.Rows.RemoveAt(0); } this.radGridView1.EndUpdate(); } } WORKAROUND II: while (this.radGridView1.Rows.Count > 0) { this.radGridView1.Rows.RemoveAt(this.radGridView1.Rows.Count - 1); }
To reproduce: public Form1() { InitializeComponent(); this.Text = Telerik.WinControls.VersionNumber.MarketingVersion + " " + Telerik.WinControls.VersionNumber.Number; this.radGridView1.Dock = DockStyle.Fill; string[] coffeeDrinks = { "Americano", "Cafe Crema", "Caffe Latte", "Caffe macchiato", "Coffee milk", "Cafe mocha", "Irish coffee", }; DataTable tableDrinks = new DataTable(); tableDrinks.Columns.Add("DrinkID", typeof(int)); tableDrinks.Columns.Add("Drink", typeof(string)); tableDrinks.Columns.Add("State", typeof(bool)); for (int i = 0; i < coffeeDrinks.Length; i++) { if (i % 2 == 0) { tableDrinks.Rows.Add(i, coffeeDrinks[i], true); } else { tableDrinks.Rows.Add(i, coffeeDrinks[i], false); } } this.radGridView1.DataSource = tableDrinks; GroupDescriptor descriptor = new GroupDescriptor(); descriptor.GroupNames.Add("State", ListSortDirection.Ascending); this.radGridView1.GroupDescriptors.Add(descriptor); this.radGridView1.MasterTemplate.ExpandAllGroups(); this.radGridView1.TableElement.GroupIndent = 1; } When set the GroupIndent property to 1, the space should be 1 pixel. Currently is bigger than 1 pixel (see attached image). And when users wants to hide the indent column, can not set the GroupIndent property to 0. Workaround: this.radGridView1.TableElement.GroupIndent = 1; foreach (GridViewColumn col in this.radGridView1.TableElement.ViewElement.RowLayout.RenderColumns) { if (col is GridViewIndentColumn) { col.MinWidth = 0; break; } }