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; } }
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.
The CustomSorting event should manipulate the pinned rows as well. Thus, the user will be allowed to control the sort order of the pinned rows within the pinned container.
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.
Workaround: private void RadForm1_Load(object sender, EventArgs e) { this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); this.productsTableAdapter.Fill(this.nwindDataSet.Products); radGridView1.AutoGenerateHierarchy = true; radGridView1.DataSource = this.nwindDataSet; radGridView1.DataMember = "Categories"; radGridView1.Rows[0].IsExpanded = !radGridView1.Rows[0].IsExpanded; radGridView1.Rows[0].IsExpanded = !radGridView1.Rows[0].IsExpanded; } Image expandedSign; Image collapsedSign; private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { GridGroupExpanderCellElement expanderCell = e.CellElement as GridGroupExpanderCellElement; if (expanderCell != null) { if (expandedSign == null && expanderCell.Expander.SignImage != null && e.Row.IsExpanded == false) { expandedSign = expanderCell.Expander.SignImage.Clone() as Image; } if (collapsedSign == null && expanderCell.Expander.SignImage != null && e.Row.IsExpanded == true) { collapsedSign = expanderCell.Expander.SignImage.Clone() as Image; } if (expandedSign != null && collapsedSign != null) { expanderCell.Expander.SignImage = null; } if (e.Row.IsExpanded) { expanderCell.Expander.Image = collapsedSign; } else { expanderCell.Expander.Image = expandedSign; } expanderCell.Expander.ImageLayout = ImageLayout.None; expanderCell.Expander.DrawImage = true; expanderCell.Expander.ImageAlignment = ContentAlignment.TopLeft; } }
To reproduce: please refer to the attached sample project. Workaround: this.radGridView1.TableElement.ScrollToRow(this.radGridView1.RowCount-1);
Attached project for reproducing. Workaround: var column = radGridView1.Columns[2] as GridViewDecimalColumn; var format = column.FormatString; column.FormatString = ""; column.ExcelExportType = DisplayFormatType.Currency; //export the grid column.FormatString = format;
Please refer to the attached sample project and follow the steps illustrated in the attached gif file.