To reproduce: 1. Run the attached sample project. 2. Move the form to the right bottom of the screen. 3. Hover a cell to show the tool tip. It will start blinking. Please refer to the attached gif file. Workaround: use screen tips: http://docs.telerik.com/devtools/winforms/telerik-presentation-framework/tooltips-and-screentips/screen-tips
To reproduce: 1. Add a RadGridView with a GridViewCheckBoxColumn and enable the paging functionality for it. 2. Toggle the header checkbox on the first page. Only the rows from the page are toggled. Workaround: you can subscribe to the HeaderCellToggleStateChanged event and toggle all rows: private void radGridView1_MouseUp(object sender, MouseEventArgs e) { if (this.radGridView1.Tag+""=="toggle") { this.radGridView1.Tag = null; this.radGridView1.HeaderCellToggleStateChanged -= radGridView1_HeaderCellToggleStateChanged; } } private void radGridView1_MouseDown(object sender, MouseEventArgs e) { RadCheckBoxElement element = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as RadCheckBoxElement; if (element != null && element.Parent is GridCheckBoxHeaderCellElement) { this.radGridView1.Tag = "toggle"; this.radGridView1.HeaderCellToggleStateChanged += radGridView1_HeaderCellToggleStateChanged; } } private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e) { this.radGridView1.BeginUpdate(); foreach (GridViewRowInfo row in this.radGridView1.Rows) { row.Cells["Discontinued"].Value = e.State; } this.radGridView1.EndUpdate(); }
How to reproduce public partial class Form1 : RadForm { public Form1() { InitializeComponent(); GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.Name = "Column"; textBoxColumn.HeaderText = "Column"; this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn); GridViewTextBoxColumn textBoxColumn2 = new GridViewTextBoxColumn(); textBoxColumn2.Name = "TextBoxColumn2"; textBoxColumn2.HeaderText = "ReadOnlyColumn"; this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn2); for (int i = 0; i < 10; i++) { object v = i * 2; if (i % 3 == 0) { v = null; } this.radGridView1.Rows.Add(new object[] { i, v }); } this.radGridView1.MultiSelect = true; foreach (var row in this.radGridView1.Rows) { foreach (var cell in row.Cells) { GridViewCellInfo cellInfo = cell as GridViewCellInfo; if (cellInfo != null && cellInfo.RowInfo.Index % 3 == 0 && cellInfo.ColumnInfo.Index == 1) { cellInfo.ReadOnly = true; } } } } } Workaround: public class MyRadGridView : RadGridView { public override string ThemeClassName { get { return typeof(RadGridView).FullName; } } protected override RadGridViewElement CreateGridViewElement() { return new MyRadGridViewElement(); } } internal class MyRadGridViewElement : RadGridViewElement { protected override Type ThemeEffectiveType { get { return typeof(RadGridViewElement); } } protected override MasterGridViewTemplate CreateTemplate() { return new MyMasterGridViewTemplate(); } } internal class MyMasterGridViewTemplate : MasterGridViewTemplate { protected override void PasteDataToRow(List<string> rowData, GridViewRowInfo row) { { int colIndex = this.Owner.CurrentColumn.Index; int j = 0; while (j < rowData.Count && colIndex < this.CurrentView.ViewTemplate.ColumnCount) { GridViewColumn col = this.CurrentView.ViewTemplate.Columns[colIndex]; if (col.IsVisible && !col.ReadOnly && !row.Cells[colIndex].ReadOnly) { object value = rowData[j]; if (string.IsNullOrEmpty(rowData[j])) { value = null; } else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(string)) { GridViewTextBoxColumn textColumn = col as GridViewTextBoxColumn; if (textColumn != null && textColumn.MaxLength > 0) { if (rowData[j].Length > textColumn.MaxLength) { value = rowData[j].Substring(0, textColumn.MaxLength); } } } else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(DateTime)) { try { value = DateTime.Parse(rowData[j], this.CurrentView.ViewTemplate.Columns[colIndex].FormatInfo); } catch { } } else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(Color)) { try { value = ColorTranslator.FromHtml(rowData[j]); } catch { } } if (this.ClipboardPasteMode == GridViewClipboardPasteMode.EnableWithNotifications) { CellValidatingEventArgs cellValidating = new CellValidatingEventArgs(row, col, value, row.Cells[colIndex].Value, null); this.EventDispatcher.RaiseEvent<CellValidatingEventArgs>(EventDispatcher.CellValidating, this, cellValidating); if (!cellValidating.Cancel) { row.Cells[colIndex].Value = value; CellValidatedEventArgs cellValidated = new CellValidatedEventArgs(row, col, value); this.EventDispatcher.RaiseEvent<CellValidatedEventArgs>(EventDispatcher.CellValidated, this, cellValidated); } } else { row.Cells[colIndex].Value = value; } j++; } colIndex++; } } } }
To reproduce: run the attached sample project: 1. Clear the value in one of the cells. 2. Select the empty cell and press Ctrl+C to copy the empty cell. You will encounter the error coming from the GetFormattedCellValue method. Workaround: handle the RadGridView.Copying event private void RadGridView1_Copying(object sender, GridViewClipboardEventArgs e) { if (this.radGridView1.SelectionMode == GridViewSelectionMode.FullRowSelect) { foreach (var row in this.radGridView1.SelectedRows) { foreach (var cell in row.Cells) { GridViewCellInfo cellInfo = cell as GridViewCellInfo; if (cellInfo != null && cellInfo.Value == null) { cellInfo.Value = ""; } } } } else { foreach (var cell in this.radGridView1.SelectedCells) { if (cell.Value == null) { cell.Value = ""; } } } }
To reproduce: - Create ColumnGroupsViewDefinition and export it with the following code: SpreadExportRenderer renderer = new SpreadExportRenderer(); GridViewSpreadExport spreadExporter = new GridViewSpreadExport(radGridView1); spreadExporter.FreezeHeaderRow = true; spreadExporter.ExportViewDefinition = true; spreadExporter.ExportVisualSettings = true; spreadExporter.ExportGroupedColumns = true; spreadExporter.ExportHierarchy = true; spreadExporter.SheetMaxRows = ExcelMaxRows._1048576; spreadExporter.ExportFormat = SpreadExportFormat.Xlsx; spreadExporter.FileExportMode = FileExportMode.CreateOrOverrideFile; spreadExporter.RunExport(dialog.FileName, renderer); Workaround: - Set FreezeHeaderRow to false. You can manually freeze the rows as well: private void Renderer_WorkbookCreated(object sender, WorkbookCreatedEventArgs e) { e.Workbook.ActiveWorksheet.ViewState.FreezePanes(2, 0); }
To reproduce: run the attached sample project and group by the Id column. Workaround: use the ViewCellFormatting event to populate the missing values or use a custom GridViewSummaryItem and override the Evaluate method in order to achieve the desired calculation.
Hi Mostafa, The end users can copy a single cell even when the SelectionMode is set to FullRowSelect via the ContextMenu when opening it on any of the data cells. If the context menu is opened on the row header they will select the whole row. Please check the attached video: radgridview-context-menu-behavior.gif. If you would like to copy a single cell using the Ctrl-C command and have the grid setup in FullRowSelect mode please check the attached project featuring a solution. I am also attaching a video showing the result using the custom implementation in the project: radgridview-full-row-ctrl-c.gif
To reproduce: please refer to the attached gif file. 1. Run the attached sample project. 2. Toggle the checkbox and scroll to a specific row. 3. Click the button to hide a column. You will notice that the vertical scrollbar changes its position. If the AutoSizeRows property is set to false, the scrollbar keeps its position. Workaround: private void radToggleButton1_ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args) { int scrollBarValue = this.radGridView1.TableElement.VScrollBar.Value; bool visible = true; if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { visible = false; } this.radGridView1.MasterTemplate.BeginUpdate(); for (int i = 1; i < this.radGridView1.Columns.Count; i += 2) { this.radGridView1.Columns[i].IsVisible = visible; } this.radGridView1.MasterTemplate.EndUpdate(); this.radGridView1.TableElement.VScrollBar.Value = scrollBarValue; }
Use the attached project to reproduce. - Start the project and group by any column and export the grid. - The same code works finme if the document is imported. Workaround: Edit the document after it is exported: var provider = new XlsxFormatProvider(); var workbook = new Workbook(); using (var stream = File.OpenRead(@"D:\123.xlsx")) { workbook = provider.Import(stream); } PatternFill solidPatternFill = new PatternFill(PatternType.Solid, System.Windows.Media.Color.FromRgb(46, 204, 113), Colors.Transparent); CellValueFormat textFormat = new CellValueFormat("@"); Worksheet sheet = workbook.ActiveWorksheet; CellRange range = new CellRange(0, 0, 1, 4); CellSelection header = sheet.Cells[range]; if (header.CanInsertOrRemove(range, ShiftType.Down)) { header.Insert(InsertShiftType.Down); } header.Merge(); header.SetFormat(textFormat); header.SetFontFamily(new ThemableFontFamily("Rockwell")); header.SetFontSize(24); header.SetHorizontalAlignment(Telerik.Windows.Documents.Spreadsheet.Model.RadHorizontalAlignment.Center); header.SetVerticalAlignment(Telerik.Windows.Documents.Spreadsheet.Model.RadVerticalAlignment.Center); header.SetFill(solidPatternFill); header.SetValue("Test"); using (var stream = File.OpenWrite("result.xlsx")) { provider.Export(workbook, stream); } Process.Start("result.xlsx");
When I add summary rows to my radgridview. something strange is happening. I demonstrate it to you in two pictures. please take a look at attachments
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.
Until released one can format the nodes this way: 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; popup.MenuTreeElement.TreeView.NodeFormatting += TreeView_NodeFormatting; } } int monthNumber = -1; private void TreeView_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { if (e.Node.Level == 2) { if (int.TryParse(e.Node.Text, out monthNumber)) { e.NodeElement.ContentElement.Text = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(monthNumber); } } }
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); GridViewComboBoxColumn supplierColumn = new GridViewComboBoxColumn(); supplierColumn.Name = "SupplierColumn"; supplierColumn.HeaderText = "Supplier"; supplierColumn.DataSource = this.GetListItemData(); ; supplierColumn.ValueMember = "Id"; supplierColumn.DisplayMember = "Description"; supplierColumn.Width = 200; this.radGridView1.Columns.Add(supplierColumn); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.CellEditorInitialized += RadGridView1_CellEditorInitialized; } private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor; if (editor == null) { return; } RadDropDownListEditorElement element = (RadDropDownListEditorElement)editor.EditorElement; element.ValueChanging -= Element_ValueChanging; element.ValueChanging += Element_ValueChanging; } private void Element_ValueChanging(object sender, ValueChangingEventArgs e) { Console.WriteLine("ValueChanging"); Console.WriteLine("Old " + e.OldValue); Console.WriteLine("New " + e.NewValue); } 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)); for (int i = 0; i < 100; i++) { dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i)); } return dt; } public List<Item> GetListItemData() { List<Item> items = new List<Item>(); for (int i = 0; i < 10; i++) { items.Add(new Item(i, "Data" + i, DateTime.Now.AddDays(i).AddHours(i))); } return items; } } public class Item { public int Id { get; set; } public string Description { get; set; } public DateTime Date { get; set; } public Item(int id, string description, DateTime date) { this.Id = id; this.Description = description; this.Date = date; } } Workaround: handle the TextChanging event and store locally the old value private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor; if (editor == null) { return; } RadDropDownListEditorElement element = (RadDropDownListEditorElement)editor.EditorElement; element.TextChanging-= Element_TextChanging; element.TextChanging += Element_TextChanging; element.ValueChanging -= Element_ValueChanging; element.ValueChanging += Element_ValueChanging; } object oldValue; private void Element_TextChanging(object sender, TextChangingEventArgs e) { oldValue = e.OldValue; } private void Element_ValueChanging(object sender, ValueChangingEventArgs e) { Console.WriteLine("ValueChanging"); Console.WriteLine("Old " + oldValue); Console.WriteLine("New " + e.NewValue); }
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: Please refer to the attached gif file and follow the steps DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("ParentId", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); Random rand = new Random(); for (int i = 0; i < 5; i++) { dt.Rows.Add(i, -1, DateTime.Now); } for (int j = 5; j < 10; j++) { dt.Rows.Add(j, rand.Next(0, 5), DateTime.Now.AddDays(j)); } this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "Id", "ParentId"); this.radGridView1.DataSource = dt; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewDateTimeColumn dateTimeColumn = this.radGridView1.Columns.Last() as GridViewDateTimeColumn; dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date; this.radGridView1.EnableFiltering = true; Workaround: use the standard hierarchy: http://docs.telerik.com/devtools/winforms/gridview/hierarchical-grid/binding-to-hierarchical-data-programmatically OR the custom filtering: http://docs.telerik.com/devtools/winforms/gridview/filtering/custom-filtering
We'd like to see the ability to enable a search/filter function for column chooser. One of our applications that uses the RadGridView has dozens of columns, most hidden by default. Our users would like the ability to type in part of a column name and have the column chooser filter on it.
To reproduce: 1. Filter the first column in the grid 2. Click the header checkbox 3. Try to clear the filter. you iwll notice that the data is still filtered. Workaround: private void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e) { if (e.CellType==typeof(GridCheckBoxHeaderCellElement)) { e.CellElement = new CustomHeaderCell(e.Column, e.Row); } } public class CustomHeaderCell : GridCheckBoxHeaderCellElement { public CustomHeaderCell(GridViewColumn column, GridRowElement row) : base(column, row) { } protected override void checkbox_ToggleStateChanged(object sender, StateChangedEventArgs args) { base.checkbox_ToggleStateChanged(sender, args); this.TableElement.EndUpdate(false); } }
How to reproduce: Check the attached video --> radgridview-filtering.gif Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.EnableFiltering = true; this.radGridView1.FilterChanging += RadGridView1_FilterChanging; this.radGridView1.FilterChanged += RadGridView1_FilterChanged; } private void RadGridView1_FilterChanged(object sender, GridViewCollectionChangedEventArgs e) { if (clearFiler) { this.radGridView1.FilterDescriptors.Remove((FilterDescriptor)e.NewItems[0]); clearFiler = false; } } bool clearFiler = false; private void RadGridView1_FilterChanging(object sender, GridViewCollectionChangingEventArgs e) { if (e.PropertyName == "Operator" && e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanging) { FilterDescriptor fd = e.OldItems[0] as FilterDescriptor; if (fd != null && (fd.Operator == FilterOperator.IsNull || fd.Operator == FilterOperator.IsNotNull)) { clearFiler = true; } } } 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)); for (int i = 0; i < 100; i++) { dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } return dt; } }