How to reproduce: public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; GridViewDecimalColumn decimalColumn = this.radGridView1.Columns[0] as GridViewDecimalColumn; decimalColumn.DecimalPlaces = 2; decimalColumn.FormatString = "{0:N2}"; decimalColumn.ExcelExportType = DisplayFormatType.Custom; decimalColumn.ExcelExportFormatString = "0.000"; } public object GridViewSpreaExport { get; private set; } private object GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(double)); 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(1.10 + i, "Name " + i, i % 2 == 0, DateTime.Now.AddDays(i)); } return dt; } private void radButton1_Click(object sender, EventArgs e) { GridViewSpreadStreamExport spreadExporter = new GridViewSpreadStreamExport(this.radGridView1); spreadExporter.FileExportMode = FileExportMode.CreateOrOverrideFile; SpreadStreamExportRenderer renderer1 = new SpreadStreamExportRenderer(); spreadExporter.RunExportAsync(@"..\..\exported-stream.xlsx", renderer1); } } Workaround: Create a custom SpreadStreamExportRenderer public class CustomSpreadStreamExportRenderer : SpreadStreamExportRenderer { public override void SetCellValue(DataType dataType, object value) { switch (dataType) { case DataType.Number: this.SetNumberValue(value); break; case DataType.DateTime: this.SetDateTimeValue(value); break; case DataType.Boolean: this.SetBooleanValue(value); break; case DataType.Other: if (this.SetNumberValue(value)) { break; } if (this.SetDateTimeValue(value)) { break; } if (this.SetBooleanValue(value)) { break; } this.SetStringValue(value); break; case DataType.String: default: this.SetStringValue(value); break; } } }
To reproduce: private void MasterTemplate_ViewChanged(object sender, DataViewChangedEventArgs args) { if (args.Action == ViewChangedAction.ExpandedChanged) { } } Workaround: - Use the GroupExpanded event.
To reproduce: please refer to the attached gif file illustrating the steps how to reproduce the problem with the Demo application. Workaround: private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) { GridDataCellElement cell = e.CellElement as GridDataCellElement; if (cell != null) { if (cell.ContainsErrors) { cell.DrawBorder = true; cell.BorderBoxStyle = BorderBoxStyle.FourBorders; cell.BorderBottomColor = cell.BorderTopColor = cell.BorderRightShadowColor = cell.BorderLeftShadowColor = Color.Transparent; cell.BorderBottomShadowColor = cell.BorderTopShadowColor = cell.BorderRightColor = cell.BorderLeftColor = Color.Red; cell.BorderBottomWidth = cell.BorderTopWidth = cell.BorderRightWidth = cell.BorderLeftWidth = 1; cell.BorderDrawMode = BorderDrawModes.HorizontalOverVertical; cell.ZIndex = 2; } else { cell.ResetValue(LightVisualElement.DrawBorderProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderBoxStyleProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderBottomColorProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderBottomShadowColorProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderBottomWidthProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderTopColorProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderTopShadowColorProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderTopWidthProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderLeftColorProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderLeftShadowColorProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderLeftWidthProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.BorderDrawModeProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.ZIndexProperty, ValueResetFlags.Local); } } }
Use attached to reproduce. This is not an issue. Performing Begin/End update disposes of all elements along with the globally declared item. You need to check if the item is disposed of: void ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { if (menuItem.IsDisposed) { menuItem = new RadMenuItem(); menuItem.Text = "Custom menu item"; menuItem.Click += menuItem_Click; } e.ContextMenu.Items.Add(menuItem); }
To reproduce: please refer to the attached sample gif file. Note that it is important that the child template is bound at design time and the columns are automatically generated. Workaround: setup the ViewDefinition programmatically:
To reproduce: run the attached sample project. Type "chef" in the search box and then try to sort some of the columns. Click the header cell several times and as a result the exception will occur. Workaround: public class CustomGrid : RadGridView { public new object DataSource { get { return (object)base.DataSource; } set { GridViewSearchRowInfo.Cancel = true; Thread.Sleep(100); base.DataSource = null; this.EnableFiltering = false; base.DataSource = value; this.EnableFiltering = true; base.CurrentRow = null; } } }
Use attached project to reproduce! Another case is when the font size is changed from the settings dialog - in this case, the row height is not adjusted. Workaround: Use the following custom print style: class MyTableViewDefinitionPrintRenderer : TableViewDefinitionPrintRenderer { public MyTableViewDefinitionPrintRenderer(RadGridView grid) : base(grid) { } protected override int GetDataRowHeight(GridViewRowInfo row, TableViewRowLayoutBase rowLayout) { int result = base.GetDataRowHeight(row, rowLayout); int newHeight = 0; if (!(row is GridViewGroupRowInfo)) { foreach (GridViewColumn col in row.ViewTemplate.Columns) { if (col is GridViewRowHeaderColumn || col is GridViewIndentColumn || !col.IsVisible) { continue; } string value = row.Cells[col.Name].Value.ToString(); TableViewCellArrangeInfo info = ((TableViewRowLayout)rowLayout).LayoutImpl.GetArrangeInfo(col); float cellWidth = (float)info.CachedWidth; int currentHeight = TextRenderer.MeasureText(value, this.GridView.PrintStyle.CellFont, new Size((int)cellWidth, 0), TextFormatFlags.WordBreak).Height + this.GridView.Font.Height *4; newHeight = Math.Max(newHeight, currentHeight); } } return Math.Max(newHeight, result); } } class MyPrintStyle :GridPrintStyle { protected override BaseGridPrintRenderer InitializePrintRenderer(RadGridView grid) { return new MyTableViewDefinitionPrintRenderer(grid); } }
To reproduce: run the attached sample project and click the 'export' button. The exported file fill be automatically opened. If you select several cells from the UnitPrice column you will see at the bottom that the cell values ' total is displayed. However, if you include the summary item's value in the selection its value is not taken into consideration. If you pay attention to the cell's format, it will be General instead of custom numeric one. Workaround: Private Sub spreadExporter_CellFormatting(sender As Object, e As Telerik.WinControls.Export.CellFormattingEventArgs) If e.GridRowInfoType = GetType(GridViewSummaryRowInfo) AndAlso e.GridCellInfo.ColumnInfo.Name = "DecimalColumn" Then Dim cellSelection As CellSelection = TryCast(e.CellSelection, CellSelection) Dim cellFormat As New CellValueFormat("### ### ###.00") If cellFormat IsNot Nothing Then cellSelection.SetValue(Decimal.Parse(cellSelection.GetValue().Value.RawValue.Replace(" ", ""))) cellSelection.SetFormat(cellFormat) End If End If End Sub
To reproduce, perform the following steps with the attached project: Step 1: Create Sample Database ============================== New (Sample1.db) Import Save Close Step 2: ====== Open (Sample1.db) Import Save Close Step 3: ====== New (Sample2.db) Import (Exception) Workaround: radGridView1.GridViewElement.Navigator = new MyNavigator(); class MyNavigator : BaseGridNavigator { public override bool SelectLastRow() { var enumerator = typeof(BaseGridNavigator).GetField("enumerator", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this) as GridTraverser; enumerator.Reset(); return base.SelectLastRow(); } }
To reproduce: DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("NumberAsShort", typeof(ushort)); for (int i = 0; i < 100; i++) { dt.Rows.Add(i, "Row" + i, i ); } this.radGridView1.DataSource = dt; Workaround: use the CellFormatting event https://docs.telerik.com/devtools/winforms/gridview/cells/formatting-cells
Workaround: adjust the cell/row spacing this.radGridView1.TableElement.CellSpacing = -2; this.radGridView1.TableElement.RowSpacing = -2;
Workaround: private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) { GridDataCellElement cell = e.CellElement as GridDataCellElement ; if (cell!=null && cell.SelfReferenceLayout!=null) { foreach (RadElement item in cell.SelfReferenceLayout.StackLayoutElement.Children) { if (!(item is GridTreeExpanderItem)) { item.Visibility = ElementVisibility.Collapsed; } else { item.Visibility = ElementVisibility.Visible; } } } }
To reproduce: run the attached sample project and press the "stream export" button. Workaround: use the GridViewSpreadExport https://docs.telerik.com/devtools/winforms/gridview/exporting-data/spread-export Dim spreadExporter As GridViewSpreadExport = New GridViewSpreadExport(RadGridView1) Dim exportRenderer As New SpreadExportRenderer() Dim fileName As String = "..\..\Export" & DateTime.Now.ToLongTimeString().Replace(":", "_") + ".xlsx" spreadExporter.RunExport(fileName, exportRenderer)
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.
To reproduce: Public Class RadForm1 Public RadGridView1 As RadGridView Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles Me.Load CreateGrid() FormatGrid() SetDataSource() End Sub Private Sub CreateGrid() Try RadGridView1 = New RadGridView Me.Controls.Add(RadGridView1) Catch ex As Exception MessageBox.Show(Me, ex.Message) End Try End Sub Private Sub FormatGrid() Dim col As GridViewTextBoxColumn With RadGridView1 col = New GridViewTextBoxColumn With col .FieldName = "FieldID" 'NOTE: Comment out NullValue = "" to prevent the unhandled exception .NullValue = "" End With .Columns.Add(col) End With End Sub Private Sub SetDataSource() Dim table As DataTable = Nothing Dim row As DataRow = Nothing table = New DataTable("GridList") table.Columns.Add("FieldID", GetType(System.Guid)) row = table.NewRow row("FieldID") = Guid.Empty table.Rows.Add(row) RadGridView1.DataSource = table End Sub End Class Workaround: Comment this line NullValue = ""
Please refer to the attached sample project. The ResizeColumnsProportionally.gif illustrates the correct behavior of columns resizing. However, if you make a certain column with fixed size, the columns resizing is not proportional any more. The ColumnsWidthNOTAdjustedProportionally.gif demonstrates better the wrong behavior. Workaround: handle the SizeChanged event and adjust the columns' width property programmatically in order to obtain the desired widths.