Use attached to reproduce. Workaround: class MyDataCellElement : GridDataCellElement { public MyDataCellElement(GridViewColumn col, GridRowElement row) : base(col,row) { } protected override List<CharacterRange> GetSearchHighlightRanges() { // return base.GetSearchHighlightRanges(); List<CharacterRange> ranges = new List<CharacterRange>(); if (this.ColumnInfo == null || !this.RowInfo.SearchCache.Contains(this.ColumnInfo)) { return ranges; } string criteria = this.RowInfo.SearchCache[this.ColumnInfo] as string; int index = -1; CompareOptions options; if (this.MasterTemplate.MasterViewInfo.TableSearchRow.CaseSensitive) { options = CompareOptions.Ordinal; } else { options = this.MasterTemplate.MasterViewInfo.TableSearchRow.CompareOptions; } do { if (index + 1 >= this.Text.Length) { break; } index = this.MasterTemplate.MasterViewInfo.TableSearchRow.Culture.CompareInfo.IndexOf(this.Text, criteria, index + 1, options); if (index >= 0) { var str = this.Text.Substring(index, criteria.Length); int symbolCount = 0; foreach (char ch in str) { if (!Char.IsLetterOrDigit(ch)) { symbolCount++; } } ranges.Add(new CharacterRange(index, criteria.Length + symbolCount)); } } while (index >= 0 && ranges.Count < 32); return ranges; } } private void MasterTemplate_CreateCell(object sender, GridViewCreateCellEventArgs e) { if (e.CellType == typeof(GridDataCellElement)) { e.CellElement = new MyDataCellElement(e.Column, e.Row); } }
To reproduce: run the attached sample project and click the new row. Workaround: don't call the Begin/EndUpdate methods in the CurrentRowChanged event.
How to reproduce: check the attached project Workaround: create a 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 = (IRadListFilterElement)typeof(RadListFilterPopup).GetField("listFilterElement", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this); RadListFilterDistinctValuesTable selectedValues = listFilterElement.SelectedValues; 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 = this.DataColumn.Name; RadListFilterDistinctValuesTable distinctValues = this.GetDistinctValuesTable(); string blanksKey = RadGridLocalizationProvider.CurrentProvider.GetLocalizedString(RadGridStringId.FilterMenuBlanks); bool blanks = selectedValues.Contains(blanksKey); if (selectedValues.Count > distinctValues.Count / 2 && !blanks) { compositeFilterDescriptor.LogicalOperator = FilterLogicalOperator.And; foreach (DictionaryEntry entry in distinctValues) { string key = (string)entry.Key; if (string.IsNullOrEmpty(key)) { key = blanksKey; } if (!selectedValues.Contains(key)) { foreach (object value in (ArrayList)entry.Value) { FilterDescriptor descriptor; if (value == DBNull.Value) { descriptor = new FilterDescriptor(this.DataColumn.Name, FilterOperator.IsNotEqualTo, null); } else if (this.DataColumn is GridViewDateTimeColumn || this.DataColumn.DataType == typeof(DateTime) || this.DataColumn.DataType == typeof(DateTime?)) { descriptor = new DateFilterDescriptor(this.DataColumn.Name, FilterOperator.IsNotEqualTo, (DateTime?)value, false); } else { descriptor = new FilterDescriptor(this.DataColumn.Name, FilterOperator.IsNotEqualTo, value); } compositeFilterDescriptor.FilterDescriptors.Add(descriptor); } } } } else { compositeFilterDescriptor.LogicalOperator = FilterLogicalOperator.Or; foreach (DictionaryEntry entry in selectedValues) { foreach (object value in (ArrayList)entry.Value) { FilterDescriptor descriptor; if (value == DBNull.Value) { descriptor = new FilterDescriptor(this.DataColumn.Name, FilterOperator.IsNotEqualTo, null); } else if (this.DataColumn is GridViewDateTimeColumn || this.DataColumn.DataType == typeof(DateTime) || this.DataColumn.DataType == typeof(DateTime?)) { descriptor = new DateFilterDescriptor(this.DataColumn.Name, FilterOperator.IsEqualTo, (DateTime?)value, false); } else { descriptor = new FilterDescriptor(this.DataColumn.Name, FilterOperator.IsEqualTo, value); } compositeFilterDescriptor.FilterDescriptors.Add(descriptor); } } } this.FilterDescriptor = compositeFilterDescriptor; OnFilterConfirmed(); } } }
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); } }
Currently, DisplayFormatType.GeneralDate, DisplayFormatType.ShortDate, DisplayFormatType.MediumDate all return culture's DateTimeFormat.ShortDatePattern. Workaround: GridViewDateTimeColumn columnDateTime = this.radGridView1.Columns["Date"] as GridViewDateTimeColumn; columnDateTime.ExcelExportType = DisplayFormatType.Custom; columnDateTime.ExcelExportFormatString = "dd/MM/yyyy hh:mm:ss";
To reproduce: bind the grid to a DataTable where one of the columns doesn't allow null values. Try to add a new record by using the new row in the grid. Even though you specify default values in the DefaultValuesNeeded event, the error still occurs. Please refer to the attached sample project and gif file. Workaround: handle the RadGridView.DataError event: private void RadGridView1_DataError(object sender, Telerik.WinControls.UI.GridViewDataErrorEventArgs e) { if (e.Exception.ToString().Contains("does not allow nulls")) { e.Cancel = true; } }
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); } } }
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); }
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
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; } }
Use attached to reproduce. Workaround: class MyViewDefinition : TableViewDefinition { public override IRowView CreateViewUIElement(GridViewInfo viewInfo) { return new MyTableElement(); } } class MyTableElement : GridTableElement { public override void DpiScaleChanged(SizeF scaleFactor) { if (this.ViewTemplate != null) { base.DpiScaleChanged(scaleFactor); } } protected override Type ThemeEffectiveType { get { return typeof(GridTableElement); } } } //use the above definition like this: radGridView1.ViewDefinition = new MyViewDefinition();
Workaround: Use the Copying event.
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; } }
To reproduce: please refer to the attached sample project. Click the button several times to add 3-4000 rows and toggle the checkbox. You will notice that every time you add new rows and hide the column it takes a long time. The more rows you have, the more time it requires. Workaround: radGridView1.MasterTemplate.BeginUpdate(); radGridView1.Columns[0].IsVisible = checkBox1.Checked; radGridView1.MasterTemplate.EndUpdate();
Steps to reproduce: 1. Set DPI scale to 150 of all screens 2. Run attached sample 3. The column`s width is not calculated correctly.