ADD. RadGridView - add functionality to automatically scroll to the needed position, during multiple selection of cells with the traslucent rectangle. MultiSelect = true SelectionMode = cells
Workaround: set the data type of the column to null before saving the layout and after loading it set it with the needed type
The performance of excel-like filtering when you have more than 5000+ row in RadGridView.
The GroupRow Height cannot be changed when ColumnGroupsViewDefinition and HtmlViewDefinition are used.
To reproduce set AddNewRowPosition is Bottom and the NewRowEnterKeyMode is EnterMovesToNextCell and add a new row via na UI Workaround: void radGridView1_RowsChanged(object sender, GridViewCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add && radGridView1.CurrentRow is GridViewNewRowInfo) { } }
ADD. RadGridView should support filtering operations when custom TypeConverters are used.
To reproduce, use the following localization provider and set a fitler to a boolean column in RadGridView, via the Custom filtering dialog. class MyRadGridLocalizationProvider : RadGridLocalizationProvider { public const string CustomTrue = "CustomTRUE"; public const string CustomFalse = "CustomFALSE"; public override string GetLocalizedString(string id) { if (id == "CustomFilterDialogTrue") { return CustomTrue; } else if (id == "CustomFilterDialogFalse") { return CustomFalse; } else { return base.GetLocalizedString(id); } } } Workaround - create custom type converter as follows: public class MyBooleanConverter : BooleanConverter { public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { if (value is string) { string text = Convert.ToString(value); if (text == MyRadGridLocalizationProvider.CustomTrue) { return true; } else if (text == MyRadGridLocalizationProvider.CustomFalse) { return false; } } return base.ConvertFrom(context, culture, value); } } and apply it to the check box column: radGridView1.Columns["BoolColumn"].DataTypeConverter = new MyBooleanConverter();
The row's MaxHeight property does not affect the row sizing when the AutoSizeRows property of RadGridView is enabled. Workaround: Use the following data row: public class MyGridDataRowElement : GridDataRowElement { protected override Type ThemeEffectiveType { get { return typeof(GridDataRowElement); } } protected override System.Drawing.SizeF MeasureCore(System.Drawing.SizeF availableSize) { float maxHeight = this.RowInfo.MaxHeight; bool isAutoSize = this.GridViewElement.AutoSize && this.RowInfo.MaxHeight > 0 && availableSize.Height == float.PositiveInfinity; SizeF size = base.MeasureCore(availableSize); if (isAutoSize && size.Height > maxHeight) { availableSize.Height = maxHeight; size = base.MeasureCore(availableSize); } return size; } } here is how to replace it and set the max height: void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e) { e.RowElement.RowInfo.MaxHeight = 32; } void radGridView1_CreateRow(object sender, GridViewCreateRowEventArgs e) { if (e.RowType == typeof(GridDataRowElement)) { e.RowType = typeof(MyGridDataRowElement); } }
When a Right-To-Left grid is printed the text of all print cells should be drawn with the StringFormatFlags.DirectionRightToLeft. Example: RadGridView with RightToLeft set to Yes A decimal column with negative values the values in the decimal column are drawn as 96-, 88- etc if this grid is printed the values will be -96, -88 Workaround: http://www.telerik.com/community/forums/radprintdocument-from-a-grid-wrong-format-when-right-to-left-true-in-grid
Use attached to reproduce. - Check the filter box - Uncheck the header checkbox. - The cells are still visible and you cannot click on the data check boxes.
IMPROVE. RadGridView - when sorting grouped combo box column the DisplayMemberSort is not taken into consideration
To reproduce: run the attached sample project and click the new row. Workaround: don't call the Begin/EndUpdate methods in the CurrentRowChanged event.
Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; ((GridViewDateTimeColumn)this.radGridView1.Columns["Date"]).FormatString = "{0: yyyy-MM-dd hh:mm:ss.fff tt}"; } 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 < 100; i++) { dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } return dt; } } public class MyRadGridView : RadGridView { public override string ThemeClassName { get { return typeof(RadGridView).FullName; } } protected override RadGridViewElement CreateGridViewElement() { return new MyRadGridViewElement(); } } public class MyRadGridViewElement : RadGridViewElement { protected override Type ThemeEffectiveType { get { return typeof(MyRadGridViewElement); } } protected override MasterGridViewTemplate CreateTemplate() { return new MyMasterGridViewTemplate(); } } public class MyMasterGridViewTemplate : MasterGridViewTemplate { public override void Copy() { base.Copy(); GridViewCellInfo[] cells = null; if (this.SelectionMode == GridViewSelectionMode.CellSelect) { cells = new GridViewCellInfo[this.SelectedCells.Count]; this.SelectedCells.CopyTo(cells, 0); } else if (this.SelectionMode == GridViewSelectionMode.FullRowSelect) { GridViewDataRowInfo row = this.SelectedRows[0] as GridViewDataRowInfo; if (this.SelectedRows.Count == 1 && row.ViewTemplate.CurrentColumn != null) { cells = new GridViewCellInfo[row.Cells.Count]; for (int i = 0; i < row.Cells.Count; i++) { cells[i] = row.Cells[i]; } } } if (Clipboard.GetData(DataFormats.Text) != null) { string data = Clipboard.GetData(DataFormats.Text).ToString(); if (data != string.Empty && cells != null) { var values = data.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); StringBuilder sb = new StringBuilder(); foreach (string value in values) { DateTime date; if (DateTime.TryParse(value, out date)) { string baseFormat = "yyyy-MM-dd HH:mm tt"; foreach (var cell in cells) { if (cell.ColumnInfo is GridViewDateTimeColumn && ((DateTime)cell.Value).ToString(baseFormat) == date.ToString(baseFormat)) { sb.Append(string.Format(((GridViewDateTimeColumn)cell.ColumnInfo).FormatString, cell.Value) + "\t"); break; } } } else { sb.Append(value + "\t"); } } Clipboard.Clear(); Clipboard.SetData(DataFormats.Text, sb.ToString()); } } } }
If you have your grid bound to a table with a single string column, changing the DataType of the resulted column in RadGridView to int, should change the way the column is sorted.
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";
Description: When we scroll the RadGridView from Top to Bottom and Bottom to Top the first record is cut off, if we click the refresh button then it will be displayed properly. To reproduce: - add a RadGridView to a form - add a RadButton to a form - use the following code snippet: public Form1() { InitializeComponent(); radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; radGridView1.EnableCustomFiltering = false; this.radGridView1.AutoSizeRows = true; radGridView1.Columns["CustomerID"].Width = 100; radGridView1.Columns["CompanyName"].Width = 150; radGridView1.Columns["ContactName"].Width = 150; radGridView1.Columns["Country"].Width = 100; radGridView1.Columns["Phone"].Width = 90; radGridView1.Columns["Fax"].Width = 90; radGridView1.Columns["Phone"].AllowFiltering = false; radGridView1.Columns["Fax"].AllowFiltering = false; } private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'nwindDataSet.Customers' table. You can move, or remove it, as needed. this.customersTableAdapter.Fill(this.nwindDataSet.Customers); } private void radButton1_Click(object sender, EventArgs e) { Form1_Load(sender, e); }
To reproduce: public Form1() { InitializeComponent(); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text1")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text2")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text3")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text4")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text5")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text6")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text7")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text8")); radGridView1.Columns.Add(new GridViewDateTimeColumn("Date1")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount1")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount2")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount3")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount4")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount5")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount6")); radGridView1.DataSource = GetDataSet(); } private DataTable GetDataSet() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Text1", typeof(string))); dt.Columns.Add(new DataColumn("Text2", typeof(string))); dt.Columns.Add(new DataColumn("Text3", typeof(string))); dt.Columns.Add(new DataColumn("Text4", typeof(string))); dt.Columns.Add(new DataColumn("Text5", typeof(string))); dt.Columns.Add(new DataColumn("Text6", typeof(string))); dt.Columns.Add(new DataColumn("Text7", typeof(string))); dt.Columns.Add(new DataColumn("Text8", typeof(string))); dt.Columns.Add(new DataColumn("Date1", typeof(DateTime))); dt.Columns.Add(new DataColumn("Amount1", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount2", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount3", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount4", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount5", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount6", typeof(decimal))); for (int i = 1; i <= 150000; i++) { dt.Rows.Add(new object[] { "Example Text For Row " + i.ToString(), "Example Text For Row " + i.ToString(), "More Example Text For Row " + i.ToString(), "Even More Example Text For Row " + i.ToString(), "Lots More Example Text For Row " + i.ToString(), "Excessive Example Text For Row " + i.ToString(), "Extra Example Text For Row " + i.ToString(), "Random Example Text For Row " + i.ToString(), new DateTime(2015, i % 12 + 1, i % 28 + 1), i % 2 * 10000, i % 3 * 10000, i % 5 * 10000, i % 7 * 10000, i % 11 * 10000, i % 13 * 10000 }); } return dt; } string fileName = @"..\..\" + DateTime.Now.ToLongTimeString().Replace(":", "_"); private void button1_Click(object sender, EventArgs e) { SaveFileDialog sfdExportToExcel = new SaveFileDialog(); DialogResult exportBrowse = sfdExportToExcel.ShowDialog(); if (exportBrowse == DialogResult.OK) { GridViewSpreadExport exporter = new GridViewSpreadExport(this.radGridView1); exporter.SheetMaxRows = Telerik.WinControls.UI.Export.ExcelMaxRows._1048576; exporter.FileExportMode = FileExportMode.CreateOrOverrideFile; exporter.ExportVisualSettings = false; exporter.AsyncExportCompleted += exporter_AsyncExportCompleted; SpreadExportRenderer renderer = new SpreadExportRenderer(); exporter.RunExportAsync(fileName, renderer); } }
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); this.radGridView1.AutoGenerateColumns = false; this.radGridView1.DataSource = this.productsBindingSource; GridViewComboBoxColumn col = new GridViewComboBoxColumn(); col.DataSource = this.categoriesBindingSource; col.MinWidth = 200; col.DisplayMember = "Description"; col.ValueMember = "CategoryID"; this.radGridView1.Columns.Add(col); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.CellValueChanged += radGridView1_CellValueChanged; } private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e) { string value = "{nothing}"; if (e.Value != null) { value = Convert.ToString(e.Value); } RadMessageBox.Show("CellValueChanged. Value >> " + value); } Note: if the cell value is not null, the CellValueChanged event is not fired when the selection in drop down is not changed. Additional scenario: if you use a RadMultiColumnComboBoxElement for this column replaced in the EditorRequired, the issue is reproducible again.
To reproduce: - add RadGridView and populate manually with hierarchical data; - BestFitColumns method of the child template does not work as expected; #1 scenario: radGridView1.MasterTemplate.ExpandAll(); radGridView1.Templates[0].ExpandAll(); radGridView1.Templates[0].BestFitColumns(BestFitColumnMode.AllCells); You will notice that some of the columns in the child template are not wide enough to show the whole cell content; #2 scenario: Subscribe to the ChildViewExpanded event and call BestFitColumns: private void radGridView1_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e) { e.ChildViewInfo.ViewTemplate.BestFitColumns(BestFitColumnMode.AllCells); } As a result the firstly expanded child view adjusts child template columns width and if you expand another child view which needs greater columns width, it is not displayed correctly. Workaround: determine the column width according to the longest cell content: foreach (GridViewDataColumn col in radGridView1.Templates[0].Columns) { BestFitAllCells(col); } private void BestFitAllCells(GridViewColumn column) { MasterGridViewTemplate masterTemplate = column.OwnerTemplate.Parent as MasterGridViewTemplate; if (masterTemplate == null) { return; } RadGridView grid = masterTemplate.Owner; IVirtualizedElementProvider<GridViewRowInfo> rowProvider = grid.TableElement.RowElementProvider; IVirtualizedElementProvider<GridViewColumn> cellProvider = grid.TableElement.ColumnScroller.ElementProvider; float width = 0; foreach (GridViewRowInfo dataRow in column.OwnerTemplate.Rows) { GridRowElement row = rowProvider.GetElement(dataRow, null) as GridRowElement; row.InitializeRowView(grid.TableElement); row.Initialize(dataRow); row.UpdateInfo(); grid.TableElement.Children.Add(row); row.ResetLayout(true); GridVirtualizedCellElement cell = cellProvider.GetElement(column, row) as GridVirtualizedCellElement; cell.Attach(column, row); cell.SetContent(); cell.UpdateInfo(); row.Children.Add(cell); GridHeaderCellElement headerCell = cell as GridHeaderCellElement; if (headerCell != null) { headerCell.UpdateArrowState(); } cell.ResetLayout(true); width = Math.Max(width, this.GetCellDesiredWidth(cell)); row.Children.Remove(cell); grid.TableElement.Children.Remove(row); this.Detach(cellProvider, cell); this.Detach(rowProvider, row); } width = Math.Max(width, TextRenderer.MeasureText(column.HeaderText, grid.Font).Width); column.Width = (int)width; } private float GetCellDesiredWidth(GridCellElement cell) { cell.Measure(new SizeF(float.PositiveInfinity, float.PositiveInfinity)); return cell.DesiredSize.Width; } private void Detach(IVirtualizedElementProvider<GridViewColumn> elementProvider, GridCellElement cell) { GridVirtualizedCellElement virtualizedCell = cell as GridVirtualizedCellElement; if (virtualizedCell != null) { elementProvider.CacheElement(virtualizedCell); virtualizedCell.Detach(); return; } cell.Dispose(); } private void Detach(IVirtualizedElementProvider<GridViewRowInfo> elementProvider, GridRowElement row) { GridVirtualizedRowElement virtualizedRоw = row as GridVirtualizedRowElement; if (virtualizedRоw != null) { elementProvider.CacheElement(virtualizedRоw); virtualizedRоw.Detach(); return; } row.Dispose(); }
FIX. RadGridView - the DisplayMember, ValueMember and DataSource properties of GridViewComboBoxColumn are not visible in the property builder