To reproduce: please refer to the attached screenshot. Workaround: add the FilterDescriptor programmatically: https://docs.telerik.com/devtools/winforms/gridview/filtering/setting-filters-programmatically-(simple-descriptors)
To reproduce: this.radGridView1.Columns.Add("FIRST CELL ID A"); this.radGridView1.Rows.Add("405-55-214-41763"); this.radGridView1.Rows.Add("405-55-214-46682"); this.radGridView1.Rows.Add("405-55-214-46682"); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.MultiSelect = true; this.radGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect; Please refer to the attached gif file illustrating better the text moving. Workaround: private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) { e.CellElement.BorderBottomWidth = 2; e.CellElement.BorderRightWidth = 2; e.CellElement.BorderTopWidth = 2; e.CellElement.BorderLeftWidth = 2; }
To reproduce: this.radGridView1.SummaryRowsBottom.Insert(0, summaryRowItem2); this.radGridView1.SummaryRowsBottom.Move(2, 0); Workaround: Remove all items and add them back with a spesific order.
How to reproduce: check the attached project and video
Bind the grid to the following DataTable: DataTable dt = new DataTable(); dt.Columns.Add("X.Y"); dt.Columns.Add("X"); dt.Rows.Add("Data X.Y", "Data X"); this.radGridView1.DataSource = dt; You will notice that the second column "X" is missing. Note: if you change the order of adding the columns, both columns will be added.
The new mode should allow copying of single cells even when having the SelectionMode set to FullRowSelect. The attached project features a possible workaround.
How to reproduce: Create a grid with enabled filtering and open the excel-like filter popup of a DateTime column. Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.EnableFiltering = true; this.radGridView1.ShowFilteringRow = true; this.radGridView1.ShowHeaderCellButtons = true; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.FilterPopupInitialized += RadGridView1_FilterPopupInitialized; } private void RadGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e) { RadDateFilterPopup popup = e.FilterPopup as RadDateFilterPopup; if (popup != null && popup.Width < 300) { popup.Width += 100; popup.Height += 100; } } private object GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Bool", typeof(bool)); dt.Columns.Add("Date", typeof(DateTime)); for (int i = 0; i < 100; i++) { dt.Rows.Add(i, "Name " + i, i % 2 == 0, DateTime.Now.AddDays(1)); } return dt; } }
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.EnableFiltering = true; this.radGridView1.ShowHeaderCellButtons = true; this.radGridView1.FilterPopupRequired += RadGridView1_FilterPopupRequired; GridViewDateTimeColumn date = this.radGridView1.Columns["Date"] as GridViewDateTimeColumn; date.DataType = typeof(DateTime); date.FilteringMode = GridViewTimeFilteringMode.Date; } private void RadGridView1_FilterPopupRequired(object sender, Telerik.WinControls.UI.FilterPopupRequiredEventArgs e) { if (e.Column.GetType().Name == "GridViewDateTimeColumn") { RadListFilterPopup popup = new RadListFilterPopup(e.Column, true); e.FilterPopup = popup; } } private object GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); DateTime date = DateTime.Now; for (int i = 0; i < 1500; i++) { dt.Rows.Add(i, "Name " + i, date.AddDays(i), i % 2 == 0); } return dt; } Workaround: custom RadListFilterPopup public class MyRadListFilterPopup : RadListFilterPopup { public MyRadListFilterPopup(GridViewDataColumn dataColumn, bool groupedDateValues) : base(dataColumn, groupedDateValues) { } protected override void OnButtonOkClick(EventArgs e) { FilterOperator filterOperator = FilterOperator.IsEqualTo; IRadListFilterElement listFilterElement = typeof(RadListFilterPopup).GetField("listFilterElement", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic). GetValue(this) as IRadListFilterElement; switch (listFilterElement.SelectedMode) { case ListFilterSelectedMode.All: filterOperator = FilterOperator.None; break; case ListFilterSelectedMode.Null: filterOperator = FilterOperator.IsNull; break; case ListFilterSelectedMode.NotNull: filterOperator = FilterOperator.IsNotNull; break; } if (filterOperator != FilterOperator.IsEqualTo) { SetFilterOperator(filterOperator); this.ClosePopup(RadPopupCloseReason.CloseCalled); } else { CompositeFilterDescriptor compositeFilterDescriptor = new CompositeFilterDescriptor(); compositeFilterDescriptor.PropertyName = base.DataColumn.Name; compositeFilterDescriptor.LogicalOperator = FilterLogicalOperator.Or; foreach (DictionaryEntry entry in listFilterElement.SelectedValues) { foreach (object value in (ArrayList)entry.Value) { FilterDescriptor descriptor; if (base.DataColumn is GridViewDateTimeColumn || base.DataColumn.DataType == typeof(DateTime) || base.DataColumn.DataType == typeof(DateTime?)) { descriptor = new DateFilterDescriptor(base.DataColumn.Name, FilterOperator.IsEqualTo, (DateTime?)value, false); } else { descriptor = new FilterDescriptor(base.DataColumn.Name, FilterOperator.IsEqualTo, value); } compositeFilterDescriptor.FilterDescriptors.Add(descriptor); } } base.FilterDescriptor = compositeFilterDescriptor; OnFilterConfirmed(); } } }
To reproduce: Sub New() InitializeComponent() Dim dt As New DataTable dt.Columns.Add("Id", GetType(Integer)) dt.Columns.Add("Name", GetType(String)) For index = 1 To 1000 dt.Rows.Add(index, "Item" & index) Next Me.RadGridView1.DataSource = dt End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Dim pdfFile As String = "..\..\exportedFile.pdf" Dim pdfExporter As New GridViewPdfExport(Me.RadGridView1) pdfExporter.ShowHeaderAndFooter = True pdfExporter.FitToPageWidth = True AddHandler pdfExporter.PdfExported, AddressOf pdfExporter_PdfExported Dim renderer As New PdfExportRenderer() pdfExporter.RunExport(pdfFile, renderer) Process.Start(pdfFile) End Sub Private Sub pdfExporter_PdfExported(sender As Object, e As System.EventArgs) Dim pdfFile As String = "..\..\exportedFile.pdf" Dim document As RadFixedDocument Dim provider As Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider = New Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider() Using stream As Stream = File.OpenRead(pdfFile) document = provider.Import(stream) '<==== Error Found For Each page As RadFixedPage In document.Pages Dim editor As FixedContentEditor = New FixedContentEditor(page) editor.Position.Translate(page.Size.Width / 2, page.Size.Height - 50) Dim pageNum As Integer = document.Pages.IndexOf(page) + 1 editor.DrawText(pageNum + " of " + document.Pages.Count) Next End Using Using output As Stream = File.OpenWrite(pdfFile) provider.Export(document, output) '<==== Error Found End Using Process.Start(pdfFile) End Sub Workaround: use the PdfExportRenderer.PdfExporting event where you have access to the document and you can make any customizations to it: Dim pdfFile As String = "..\..\exportedFile.pdf" Dim pdfExporter As New GridViewPdfExport(Me.RadGridView1) pdfExporter.ShowHeaderAndFooter = True pdfExporter.FitToPageWidth = True Dim renderer As New PdfExportRenderer() AddHandler renderer.PdfExporting, AddressOf PdfExporting pdfExporter.RunExport(pdfFile, renderer) Private Sub PdfExporting(sender As Object, e As PdfExportingEventArgs) Dim document As RadFixedDocument = e.Document Dim provider As Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider = New Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider() For Each page As RadFixedPage In document.Pages Dim editor As FixedContentEditor = New FixedContentEditor(page) editor.Position.Translate(page.Size.Width / 2, page.Size.Height - 50) Dim pageNum As Integer = document.Pages.IndexOf(page) + 1 editor.DrawText(pageNum & " of " & document.Pages.Count) Next End Sub
How to reproduce: public partial class Form1 : Form { private DataTable dt = new DataTable(); public Form1() { InitializeComponent(); this.FillData(); this.radGridView1.DataSource = this.dt; this.radGridView1.EnableSorting = true; this.radGridView1.EnableFiltering = true; this.radGridView1.MasterTemplate.DataView.BypassSort = true; this.radGridView1.SortChanged += radGridView1_SortChanged; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; } public void FillData() { dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); for (int i = 0; i < 30; i++) { dt.Rows.Add(i, "Item" + i); } } private void radGridView1_SortChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add || e.Action == NotifyCollectionChangedAction.ItemChanged) { SortDescriptor s = e.NewItems[0] as SortDescriptor; string sortOperator = ""; if (s.Direction == ListSortDirection.Ascending) { sortOperator = "ASC"; } else { sortOperator = "DESC"; } dt.DefaultView.Sort = s.PropertyName + " " + sortOperator; } if (e.Action == NotifyCollectionChangedAction.Remove) { dt.DefaultView.Sort = ""; } } } Workaround: public partial class Form1 : Form { private DataTable dt = new DataTable(); public Form1() { InitializeComponent(); this.FillData(); this.radGridView1.DataSource = this.dt; this.radGridView1.EnableSorting = true; this.radGridView1.EnableFiltering = true; this.radGridView1.MasterTemplate.DataView.BypassSort = true; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.CellBeginEdit += RadGridView1_CellBeginEdit; this.radGridView1.CellEndEdit += RadGridView1_CellEndEdit; } private void RadGridView1_CellEndEdit(object sender, GridViewCellEventArgs e) { if (e.Row is GridViewFilteringRowInfo) { this.radGridView1.MasterTemplate.DataView.BypassSort = true; } } private void RadGridView1_CellBeginEdit(object sender, Telerik.WinControls.UI.GridViewCellCancelEventArgs e) { if (e.Row is GridViewFilteringRowInfo) { this.radGridView1.MasterTemplate.DataView.BypassSort = false; } } public void FillData() { dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); for (int i = 0; i < 30; i++) { dt.Rows.Add(i, "Item" + i); } } }
To reproduce: please refer to the attached gif file and sample project. Workaround: private void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e) { RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor; if (editor!=null) { RadDropDownListEditorElement el = editor.EditorElement as RadDropDownListEditorElement; el.AutoCompleteSuggest.DropDownList.ClosePopup(); } }
How to reproduce: check the attached video public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(1000); this.radGridView1.AutoExpandGroups = true; this.radGridView1.EnableFiltering = true; this.radGridView1.EnablePaging = true; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; } private DataTable GetData(int count) { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < count; i++) { dt.Rows.Add(i,"Name " + i, DateTime.Now.AddDays(i), i % 2 == 0 ? true : false); } return dt; } } Workaround: cancel the PageChanging event public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(1000); this.radGridView1.AutoExpandGroups = true; this.radGridView1.EnableFiltering = true; this.radGridView1.EnablePaging = true; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; timer = new Timer(); timer.Interval = 100; timer.Tick += (sender, e) => { timer.Stop(); this.shouldCancel = false; }; this.radGridView1.PageChanging += RadGridView1_PageChanging; this.radGridView1.CurrentRowChanged += RadGridView1_CurrentRowChanged; } private void RadGridView1_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e) { this.shouldCancel = this.ShouldCancelPageChange(e.CurrentRow); timer.Start(); } Timer timer; bool shouldCancel = false; private bool ShouldCancelPageChange(GridViewRowInfo rowInfo) { if (this.radGridView1.TableElement.MasterTemplate != null && this.radGridView1.TableElement.MasterTemplate.EnablePaging) { int pageIndex = this.radGridView1.TableElement.ViewTemplate.DataView.GetItemPage(rowInfo); if (pageIndex == this.radGridView1.TableElement.MasterTemplate.PageIndex) { return true; } } return false; } private void RadGridView1_PageChanging(object sender, Telerik.WinControls.PageChangingEventArgs e) { e.Cancel = this.shouldCancel; } private DataTable GetData(int count) { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < count; i++) { dt.Rows.Add(i,"Name " + i, DateTime.Now.AddDays(i), i % 2 == 0 ? true : false); } return dt; } }
How to reproduce: check also the attached video public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GroupDescriptor descriptor = new GroupDescriptor(); descriptor.GroupNames.Add("Name", ListSortDirection.Ascending); this.radGridView1.GroupDescriptors.Add(descriptor); } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Age", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 60; j++) { dt.Rows.Add("Name " + i, i, DateTime.Now.AddDays(i), i % 2 == 0); } } return dt; } private void radButton1_Click(object sender, EventArgs e) { GridPrintStyle style = new GridPrintStyle(); style.FitWidthMode = PrintFitWidthMode.FitPageWidth; this.radGridView1.PrintStyle = style; RadPrintDocument doc = new RadPrintDocument(); doc.HeaderHeight = 30; doc.HeaderFont = new Font("Arial", 12); doc.LeftHeader = "Left Header"; doc.MiddleHeader = "Middle header"; doc.RightHeader = "Right header"; doc.AssociatedObject = this.radGridView1; RadPrintPreviewDialog dialog = new RadPrintPreviewDialog(doc); dialog.Show(); } } Workaround: create a custom GridPrintStyle class public class MyGridPrintStyle : GridPrintStyle { protected override BaseGridPrintRenderer InitializePrintRenderer(RadGridView grid) { BaseGridPrintRenderer rend = base.InitializePrintRenderer(grid); if (rend is TableViewDefinitionPrintRenderer) { return new MyTableViewDefinitionPrintRenderer(grid); } return rend; } } public class MyTableViewDefinitionPrintRenderer : TableViewDefinitionPrintRenderer { public MyTableViewDefinitionPrintRenderer(RadGridView grid) : base(grid) { } protected override void PrintRowWideCell(GridViewRowInfo row, TableViewRowLayout rowLayout, GridPrintSettings settings, int currentX, int currentY, Graphics graphics) { int groupLevel = row.Group != null ? row.Group.Level + 1 : 0; int indentLevel = row.HierarchyLevel + 1 - groupLevel; Size cellSize = this.GetRowSize(row, rowLayout); int cellX = currentX + indentLevel * settings.HierarchyIndent + rowLayout.Owner.CellSpacing; Rectangle cellRect = new Rectangle(cellX, currentY, cellSize.Width - indentLevel * settings.HierarchyIndent, cellSize.Height); CellPrintElement printCell = new CellPrintElement(); if (row is GridViewGroupRowInfo) { if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { cellRect.Width -= this.PrintPages[this.CurrentPrintPage].Count - 1; } printCell = this.CreateGroupCellPrintElement(row as GridViewGroupRowInfo); if (printCell.Font != settings.GroupRowFont) { if (settings.GroupRowFont != null) { printCell.Font = settings.GroupRowFont; } else { settings.GroupRowFont = printCell.Font; } } } printCell.TextPadding = this.GridView.PrintStyle.CellPadding; printCell.RightToLeft = this.GridView.RightToLeft == RightToLeft.Yes; PrintCellFormattingEventArgs formattEventArgs = new PrintCellFormattingEventArgs(row, null, printCell); this.OnPrintCellFormatting(formattEventArgs); PrintCellPaintEventArgs paintEventArgs = new PrintCellPaintEventArgs(graphics, row, null, cellRect); this.OnPrintCellPaint(paintEventArgs); formattEventArgs.PrintCell.Paint(graphics, paintEventArgs.CellRect); } }
Currently the time for opening the popup for a column with 100 000 unique items including blank items is about 8s, this can be optimized. How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.EnableFiltering = true; this.radGridView1.ShowHeaderCellButtons = true; this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.MouseDown += RadGridView1_MouseDown; this.radGridView1.FilterPopupInitialized += RadGridView1_FilterPopupInitialized; } Stopwatch sw = new Stopwatch(); private void RadGridView1_MouseDown(object sender, MouseEventArgs e) { GridFilterButtonElement btn = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridFilterButtonElement; if (btn != null) { sw.Start(); } } private void RadGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e) { ((RadListFilterPopup)e.FilterPopup).PopupOpened += Form1_PopupOpened; } private void Form1_PopupOpened(object sender, EventArgs args) { sw.Stop(); Console.WriteLine("Total: " + sw.ElapsedMilliseconds); } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 100000; i++) { dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } dt.Rows.Add(1, null, DateTime.Now.AddDays(1), false); return dt; } }
To reproduce: 1. Add a GridViewCheckBoxColumn with EnableHeaderCheckBox property set to true. 2. Use the TypeConverter demonstrated in the following help article: http://docs.telerik.com/devtools/winforms/gridview/columns/converting-data-types When you run the application and try to toggle the check box in the header cell, a FormatException occurs. Workaround: modify the TypeConverter: public class ToggleStateConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(ToggleState); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { char charValue = (char)value; switch (charValue) { case 'Y': return ToggleState.On; case 'N': return ToggleState.Off; case 'M': return ToggleState.Indeterminate; } return base.ConvertTo(context, culture, value, destinationType); } public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(ToggleState) || sourceType == typeof(bool); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { ToggleState state; bool boolValue; if (value is ToggleState) { state = (ToggleState)value ; switch (state) { case ToggleState.On: return 'Y'; case ToggleState.Off: return 'N'; case ToggleState.Indeterminate: return 'M'; } } else if (value is bool) { boolValue = (bool)value; switch (boolValue) { case true: return 'Y'; case false: return 'N'; default: return 'M'; } } return base.ConvertFrom(context, culture, value); } }
Create a grid with more than 20 columns and add 5K rows for example. Maximize the form and try to scroll with mouse wheel. You will notice that the scrolling performance is worse compared to the normal state of the form with less visible visual elements. Workaround: this.radGridView1.EnableFastScrolling = true; and use the scrollbar's thumb Second workaround: use paging: https://docs.telerik.com/devtools/winforms/gridview/paging/overview Thus, you will display as many rows as possible to display on the screen per page. Instead of scrolling, you will navigate through pages.
The GridViewBrowseColumn's editor could have two modes - OpenFileDialog and FolderBrowserDialog.
By default, when I am expanding a group and start sorting, the expanded group doesn't collapse. However, if you use a group comparer, all groups will always collapse, when you click a header cell to sort.
To reproduce: - Add 7-8 columns to the grid. - Set the AutoSizeColumnsMode to Fill - Set the MaxWidth/MaxWidth of the last two columns. - Resize the first column. - Sometimes the size of the other columns is randomly increased/decreased.