Steps to reproduce: 1) Add RadGridView control 2) Use GridViewDecimalColumn: DataTable customDataTable = new DataTable(); sampleDataTable.Columns.Add("Column name", typeof(double)); 3) Set the right-to-left property of the control to true: this.radGridView1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; 4) Re-size the form manually until horizontal scroll-bar appears and you will notice that the left border is missing Expected result: the left border of the GridRowHeaderCellElement is visible Actual result: the left border of the GridRowHeaderCellElement is missing Workaround: this.radGridView1.ViewCellFormatting +=new CellFormattingEventHandler(radGridView1_ViewCellFormatting); void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { if (e.CellElement is GridRowHeaderCellElement) { e.CellElement.BorderLeftWidth = 3; } }
To reproduce: Add a RadGridView to a form, dont dock it. Use the following code to add the rows, columns and the definition: this.Grid.Columns.Add("Old"); this.Grid.Columns.Add("New"); Start the application and you will see that you cannot scroll to the end, horizontally. Workaround: Use the following code on a button click or execute it in a timer a few millisecond after the form has loaded in order to update the scrollbar's maximum value accordingly: int width = 0; foreach (var col in this.Grid.Columns) { width += col.Width; } this.Grid.TableElement.HScrollBar.Maximum = width - this.Grid.TableElement.HScrollBar.SmallChange - this.Grid.TableElement.RowHeaderColumnWidth;
How to reproduce: Public Class Form1 Sub New() InitializeComponent() Dim col As New GridViewTextBoxColumn("Column1") Me.RadGridView1.Columns.Add(col) End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Dim sw As New Stopwatch sw.Start() Me.RadGridView1.Rows.Clear() Me.RadGridView1.BeginUpdate() Dim RowInfo For ii = 1 To 100000 RowInfo = Me.RadGridView1.Rows.AddNew RowInfo.Cells("Column1").Value = ii Next Me.RadGridView1.EndUpdate() sw.Stop() Console.WriteLine("Elapsed: " & sw.Elapsed.TotalSeconds) End Sub End Class Workaround: add data to a collection and use bound mode
To reproduce: - Group the grid first. Make sure there are enough rows for two pages. - Set the AutoSizeRows property to true. Workaround: Set AutoSizeRows to false while printing.
The display member for empty string value in GridViewComboBoxColumn is not displayed. The following code reproduces the issue: GridViewComboBoxColumn cboInsRslCd = new GridViewComboBoxColumn(); cboInsRslCd.DataType = typeof(string); List<ItemComboBox> liste = new List<ItemComboBox>(); liste.Add(new ItemComboBox("", "[None]")); liste.Add(new ItemComboBox("A", "A")); liste.Add(new ItemComboBox("B", "B")); liste.Add(new ItemComboBox("C", "C")); cboInsRslCd.DataSource = liste; cboInsRslCd.ValueMember = "CleItem"; cboInsRslCd.DisplayMember = "ValeurItem"; cboInsRslCd.NullValue = "[None]"; this.radGridView1.Columns.Add(cboInsRslCd); WORKAROUND: subscribe to the CellEndEdit event and change the stored value in the event handler: private void RadGridView1_CellEndEdit(object sender, GridViewCellEventArgs e) { if (e.Value == null) { e.Row.Cells[e.Column.Name].Value = ""; } } http://www.telerik.com/community/forums/radgridview-comboboxcolumn-displays-no-value-for-member-with-empty-string-value-is-selected
To reproduce: 1. Add a RadGridView and a RadButton. 2. Use the following code snippet: Public Class Form1 Private myList As New List(Of MyObject) Sub New() InitializeComponent() PopulateGrid(300) End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click PopulateGrid(100) End Sub Private Sub PopulateGrid(count As Integer) myList.Clear() Me.RadGridView1.DataSource = Nothing For index = 1 To count myList.Add(New MyObject(index, "Item" & index)) Next Me.RadGridView1.DataSource = myList End Sub Public Class MyObject Public Sub New(ByVal myInt As Integer, ByVal myString As String) _myInt = myInt _myString = myString End Sub Private _myInt As Integer Public Property MyInt() As Integer Get Return _myInt End Get Set(ByVal value As Integer) _myInt = value End Set End Property Private _myString As String Public Property MyString() As String Get Return _myString End Get Set(ByVal value As String) _myString = value End Set End Property End Class End Class 3. Select the last item 4. Click the button Workaround: use BindingList instead of List
To reproduce: -add a RadGridView and use the following code: public Form1() { InitializeComponent(); GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn("ComboBox column"); comboColumn.DataSource = new List<string>() { "first", "second", "third" }; radGridView1.Columns.Add(comboColumn); radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized; } private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { RadDropDownListEditor dropDownEditor = radGridView1.ActiveEditor as RadDropDownListEditor; RadDropDownListEditorElement dropDownEditorElement = dropDownEditor.EditorElement as RadDropDownListEditorElement; dropDownEditorElement.SelectedIndex = 0; } If you try to add a new row in the grid, the first item in the RadDropDownListEditor is selected. If you do not make any selection changes and press Enter key, the new row will not be added. Workaround: use the DefaultValuesNeeded event for initializing RadDropDownListEditorElement's selectin
To reproduce: - Add logo in the header and export the document. Workaround: void exporter_HeaderExported(object sender, ExportEventArgs e) { PdfEditor ed = e.Editor as PdfEditor; using (MemoryStream ms = new MemoryStream()) { System.Drawing.Image.FromFile(@"C:\img\delete.png").Save(ms, System.Drawing.Imaging.ImageFormat.Png); ed.TranslatePosition(e.Rectangle.Width - 30, e.Rectangle.Y); ed.DrawImage(ms, new System.Windows.Size(30,30)); } }
A child row does not appear in the view by using following code snippet: GridViewRowInfo^ pNewRow = pTemplate->Rows->AddNew(); pNewRow->Cells["ChildNameColumn"]->Value = this->ChildTextBox->Text; int count = radGridView1->ChildRows->Count; pNewRow->Cells["ChildAddressColumn"]->Value = count.ToString() Workaround: add new rows in the following manner: private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { // add child row GridViewTemplate^ pTemplate = radGridView1->MasterTemplate->Templates[0]; GridViewRowInfo^ pNewRow = pTemplate->Rows->NewRow(); pNewRow->Cells["ChildNameColumn"]->Value = this->ChildTextBox->Text; int count = radGridView1->ChildRows->Count; pNewRow->Cells["ChildAddressColumn"]->Value = count.ToString(); pTemplate->Rows->Add(pNewRow); }
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); } } }