To reproduce: - Add ColumnGroupsViewDefinition and subscribe to ColumnWidthChanged event. - Start the application and resize a column. Workaround: public class MyColumnGroupRowLayout : ColumnGroupRowLayout { public MyColumnGroupRowLayout(ColumnGroupsViewDefinition view) : base(view) { } public override void ResizeColumn(int delta) { base.ResizeColumn(delta); //This method will be called when a column is resized } } class MyColumnGroupsViewDefinition : ColumnGroupsViewDefinition { public override IGridRowLayout CreateRowLayout() { return new MyColumnGroupRowLayout(this); } }
To reproduce: for (int i = 0; i < 5; i++) { this.radGridView1.Columns.Add("Col" + i); } ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition(); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[0].Rows[0].ColumnNames.Add("Col3"); columnGroupsView.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[1].Rows[0].ColumnNames.Add("Col2"); columnGroupsView.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[2].Rows[0].ColumnNames.Add("Col0"); columnGroupsView.ColumnGroups[2].Rows[1].ColumnNames.Add("Col1"); columnGroupsView.ColumnGroups[3].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[3].Rows[0].ColumnNames.Add("Col4"); this.radGridView1.ViewDefinition = columnGroupsView; this.radGridView1.Columns["Col2"].Width = 150; this.radGridView1.Columns["Col0"].Width = 200; Workaround: either set the columns width before setting the RadGridView.ViewDefinition or call the TableElement.ViewElement.RowLayout.InvalidateRenderColumn after specifying the width.
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.radGridView1.DataSource = this.productsBindingSource; GridViewSummaryItem summaryItem = new GridViewSummaryItem(); summaryItem.Name = "UnitPrice"; summaryItem.Aggregate = GridAggregateFunction.Count; GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem(); summaryRowItem.Add(summaryItem); this.radGridView1.SummaryRowsTop.Add(summaryRowItem); GroupDescriptor descriptor1 = new GroupDescriptor(); descriptor1.GroupNames.Add("CategoryID", ListSortDirection.Ascending); this.radGridView1.GroupDescriptors.Add(descriptor1); GroupDescriptor descriptor11 = new GroupDescriptor(); descriptor11.GroupNames.Add("SupplierID", ListSortDirection.Ascending); this.radGridView1.GroupDescriptors.Add(descriptor11); GroupDescriptor descriptor2 = new GroupDescriptor(); descriptor2.GroupNames.Add("QuantityPerUnit", ListSortDirection.Ascending); descriptor2.GroupNames.Add("UnitsInStock", ListSortDirection.Ascending); this.radGridView1.GroupDescriptors.Add(descriptor2); GroupDescriptor descriptor3 = new GroupDescriptor(); descriptor3.GroupNames.Add("UnitsOnOrder", ListSortDirection.Ascending); descriptor3.GroupNames.Add("ReorderLevel", ListSortDirection.Descending); this.radGridView1.GroupDescriptors.Add(descriptor3); GroupDescriptor descriptor4 = new GroupDescriptor(); descriptor4.GroupNames.Add("Discontinued", ListSortDirection.Ascending); this.radGridView1.GroupDescriptors.Add(descriptor4); } private void radButton1_Click(object sender, EventArgs e) { GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1); SpreadExportRenderer exportRenderer = new SpreadExportRenderer(); string filePath = @"..\..\exported" + DateTime.Now.ToShortTimeString().Replace(":", "_") + ".xlsx"; spreadExporter.ExportGroupedColumns = true; spreadExporter.ExportChildRowsGrouped = true; spreadExporter.HiddenColumnOption = Telerik.WinControls.UI.Export.HiddenOption.DoNotExport; spreadExporter.ExportVisualSettings = true; spreadExporter.SummariesExportOption = Telerik.WinControls.UI.Export.SummariesOption.ExportAll; spreadExporter.RunExport(filePath, exportRenderer); Process.Start(filePath); } Workaround: set the ExportChildRowsGrouped property to false.
To reproduce: 1. Add GridView which inherits the RadGridView 2. Populate the grid with some data 3. Add conditional formatting and set RowBackColor and CellBackColor 4. Subscribe to RowFormatting event and change the font of selected row: void radGridView2_RowFormatting(object sender, RowFormattingEventArgs e) { if (e.RowElement.IsSelected) { e.RowElement.Font = new Font(this.Font.FontFamily, this.Font.Size + 2, FontStyle.Bold); } else { e.RowElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local); //e.RowElement.Font = this.Font; } } 5. Select row with conditional formatting. The font of selected row is bold which is correct. Select another row and you will see that the previous row is still bold. Workaround: Subscribe to CellFormatting event instead RowFormatting void radGridView2_CellFormatting(object sender, CellFormattingEventArgs e) { if (e.Row.IsSelected) { e.CellElement.Font = new Font(this.Font.FontFamily, this.Font.Size + 2, FontStyle.Bold); } else { e.CellElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local); } }
BindingList<Item> items = new BindingList<Item>(); public Form1() { InitializeComponent(); for (int i = 0; i < 20; i++) { items.Add(new Item(i % 4, "Item" + i, "Type" + i % 2)); } this.radGridView1.DataSource = items; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; } public class Item { public int Id { get; set; } public string Name { get; set; } public string Type { get; set; } public Item(int id, string name, string type) { this.Id = id; this.Name = name; this.Type = type; } } private void radButton1_Click(object sender, EventArgs e) { items.Insert(0, new Item(2, "Test", "Type0")); } WORKAROUND I: GridViewSynchronizationService.SuspendEvent(this.radGridView1.MasterTemplate, KnownEvents.CurrentChanged); Item item = new Item(2, "Test", "Type0"); items.Insert(0, item); GridViewSynchronizationService.ResumeEvent(this.radGridView1.MasterTemplate, KnownEvents.CurrentChanged); foreach (GridViewRowInfo row in this.radGridView1.Rows) { if (row.DataBoundItem == item) { this.radGridView1.CurrentRow = row; break; } } WORKAROUND II: this.radGridView1.Rows.CollectionChanged += Rows_CollectionChanged; this.radGridView1.GroupExpanding+=radGridView1_GroupExpanding; List<GridViewRowInfo> expandedGroups = new List<GridViewRowInfo>(); private void radGridView1_GroupExpanding(object sender, GroupExpandingEventArgs e) { if (!e.IsExpanded && shouldCollapse) { expandedGroups.Add(e.DataGroup.GroupRow); } } bool shouldCollapse = false; private void radButton1_Click(object sender, EventArgs e) { shouldCollapse = true; items.Insert(0, new Item(2, "Test", "Type0")); } private void Rows_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add) { this.radGridView1.CurrentRow = e.NewItems[0] as GridViewRowInfo; this.radGridView1.CurrentRow.IsSelected = true; GridViewRowInfo parent = this.radGridView1.CurrentRow.Parent as GridViewRowInfo; if (parent != null) { parent.IsExpanded = true; } if (shouldCollapse) { shouldCollapse = false; foreach (GridViewRowInfo r in expandedGroups) { if (!ContainsParentRow(parent, r)) { r.IsExpanded = false; } } expandedGroups.Clear(); } } } private bool ContainsParentRow(GridViewRowInfo parent, GridViewRowInfo r) { GridViewGroupRowInfo group = r as GridViewGroupRowInfo; if (group != null) { foreach (GridViewRowInfo childRow in group.ChildRows) { return ContainsParentRow(parent, childRow); } } return parent == r.Parent; }
To reproduce: public RadForm1() { InitializeComponent(); radGridView1.AutoGenerateColumns = false; GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn(); decimalColumn.DataType = typeof(int); decimalColumn.Name = "DecimalColumn"; decimalColumn.HeaderText = "DecimalColumn"; decimalColumn.FieldName = "Dosage"; decimalColumn.Width = 200; radGridView1.MasterTemplate.Columns.Add(decimalColumn); radGridView1.DataSource = GetTable(); radGridView1.CellValidating += radGridView1_CellValidating; } void radGridView1_CellValidating(object sender, CellValidatingEventArgs e) { int value = Convert.ToInt32(e.Value); } Workaround: void radGridView1_CellValidating(object sender, CellValidatingEventArgs e) { int value = Convert.ToInt32(e.Value); }
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); radGridView1.DataSource = nwindDataSet.Categories; radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewTemplate template = new GridViewTemplate(); template.DataSource = nwindDataSet.Products; template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.MasterTemplate.Templates.Add(template); GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.RelationName = "CategoriesProducts"; relation.ParentColumnNames.Add("CategoryID"); relation.ChildColumnNames.Add("CategoryID"); radGridView1.Relations.Add(relation); this.radGridView1.CurrentRow = this.radGridView1.MasterTemplate.Templates.First().Rows[this.radGridView1.MasterTemplate.Templates.First().Rows.Count - 1]; } Workaround: this.radGridView1.MasterTemplate.ExpandAll(); this.radGridView1.MasterTemplate.CollapseAll(); this.radGridView1.CurrentRow = this.radGridView1.MasterTemplate.Templates.First().Rows[this.radGridView1.MasterTemplate.Templates.First().Rows.Count - 1]; Another scenario: if you try to add a new row to the child template on the RadButton.Click event and call the EnsureVisible(true) method, it will not affect the grid, until you expand/collapse the parent row: private void radButton1_Click(object sender, EventArgs e) { //add the new row to the child template DataRow newRow = this.nwindDataSet.Products.Rows.Add(); newRow["CategoryID"] = 3; newRow["ProductName"] = "NewProduct"; this.radGridView1.CurrentRow = this.radGridView1.MasterTemplate.Templates.First().Rows[this.radGridView1.MasterTemplate.Templates.First().Rows.Count - 1]; this.radGridView1.CurrentRow.EnsureVisible(true); } Workaround: private void radButton1_Click(object sender, EventArgs e) { //keep expanded rows List<GridViewRowInfo> expandedRows = new List<GridViewRowInfo>(); foreach (GridViewRowInfo row in this.radGridView1.Rows) { if (row.IsExpanded) { expandedRows.Add(row); } } //add the new row to the child template DataRow newRow = this.nwindDataSet.Products.Rows.Add(); newRow["CategoryID"] = 3; newRow["ProductName"] = "NewProduct"; //refresh the rows this.radGridView1.MasterTemplate.ExpandAll(); this.radGridView1.MasterTemplate.CollapseAll(); foreach (GridViewRowInfo rowToExpand in expandedRows) { rowToExpand.IsExpanded = true; } this.radGridView1.CurrentRow = null; this.radGridView1.CurrentRow = this.radGridView1.MasterTemplate.Templates.First().Rows[this.radGridView1.MasterTemplate.Templates.First().Rows.Count - 1]; this.radGridView1.CurrentRow.EnsureVisible(true); }
Please refer to the attached screenshot. Workaround: either select the RadGridView node in the Property Builder, or use the VS design time or control Smart Tag to set DataSource
To reproduce: Setup RadGridView as follows: this.Grid.MasterTemplate.EnablePaging = true; this.Grid.Columns.Add(""); this.Grid.Columns.Add(""); this.Grid.Columns.Add(""); this.Grid.Columns.Add(""); On a button click add rows: private void Button_Clic9k(object sender, EventArgs e) { for (int i = 0; i < 120; i++) { this.Grid.Rows.AddNew(); } } You will see a vertical scrollbar when it is not needed. Workaround: Wrap the loop in a Begin/EndUpdate calls: private void Button_Clic9k(object sender, EventArgs e) { this.Grid.BeginUpdate(); for (int i = 0; i < 120; i++) { this.Grid.Rows.AddNew(); } this.Grid.EndUpdate(); }
To reproduce: - Bind the grid to a DataView. The grid must have combo box column. - Change the filter of the DataView like this: Private Sub MasterTemplate_FilterExpressionChanged(sender As Object, e As FilterExpressionChangedEventArgs) Handles RadGridView.FilterExpressionChanged _companies.RowFilter = e.FilterExpression End Sub - Set a filter to the combo box column and then set reset by selecting no filter in the drop down. Workaround: Public Class MyGridFilterComboBoxCellElement Inherits GridFilterComboBoxCellElement Public Sub New(ByVal col As GridViewDataColumn, ByVal row As GridRowElement) MyBase.New(col, row) End Sub Protected Overrides Sub SetContentCore(ByVal value As Object) If Me.ComboBoxColumnInfo IsNot Nothing Then MyBase.SetContentCore(value) End If End Sub End Class Private Sub radGridView1_CreateCell(ByVal sender As Object, ByVal e As GridViewCreateCellEventArgs) If e.CellType Is GetType(GridFilterComboBoxCellElement) Then e.CellType = GetType(MyGridFilterComboBoxCellElement) End If End Sub
Workaround: before printing set the AutoSizeRows = false, then you can set it again to true private void radButton1_Click(object sender, EventArgs e) { if (!this.radGridView1.Columns["ImageColumn"].IsVisible) { int height = this.radGridView1.TableElement.ViewTemplate.Rows[0].Height; this.radGridView1.AutoSizeRows = false; this.radGridView1.TableElement.RowHeight = height; } this.radGridView1.PrintPreview(); this.radGridView1.AutoSizeRows = true; }
To reproduce: private void RadForm1_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("col1", typeof(bool)); dt.Columns.Add("col2", typeof(bool)); dt.Rows.Add(0, 1); dt.Rows.Add(0, 1); dt.Rows.Add(0, 1); RadGridView1.DataSource = dt; ((Telerik.WinControls.UI.GridViewCheckBoxColumn)RadGridView1.Columns(0)).EnableHeaderCheckBox = true; ((Telerik.WinControls.UI.GridViewCheckBoxColumn)RadGridView1.Columns(1)).EnableHeaderCheckBox = true; RadGridView1.HeaderCellToggleStateChanged += radGridView1_HeaderCellToggleStateChanged; } - Start the application and click in the second row in the first column. Workaraound: public class MyGridCheckBoxHeaderCellElement : GridCheckBoxHeaderCellElement { public MyGridCheckBoxHeaderCellElement(GridViewDataColumn col, GridRowElement row) : base(col, row) { } protected override void SetCheckBoxState(ToggleState state) { if (this.ColumnInfo.Name != this.GridViewElement.CurrentCell.ColumnInfo.Name) { return; } base.SetCheckBoxState(state); } }
Workaround: use a GridPrintStyle and define a HierarchyIndent = 0 private void PrintGrid() { GridPrintStyle style = new GridPrintStyle(); style.HierarchyIndent = 0; this.radGridView1.PrintStyle = style; this.radGridView1.PrintPreview(); }
To reproduce: public Form1() { InitializeComponent(); ColumnGroupsViewDefinition columnGroupsView; columnGroupsView = new ColumnGroupsViewDefinition(); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups[0].ShowHeader = false; columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[0].Rows[0].ColumnNames.Add("colPINNED_LEFT"); columnGroupsView.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[1].Rows[0].ColumnNames.Add("colDATE"); columnGroupsView.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[2].Rows[0].ColumnNames.Add("colTITLE"); columnGroupsView.ColumnGroups[2].Rows[1].ColumnNames.Add("colTEXT"); columnGroupsView.ColumnGroups[3].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[3].Rows[0].ColumnNames.Add("colPINNED_RIGHT"); this.radGridView1.ViewDefinition = columnGroupsView; this.radGridView1.Columns["colDATE"].Width = 110; this.radGridView1.Columns["colTITLE"].Width = this.radGridView1.Width - 181; this.radGridView1.TableElement.ViewElement.RowLayout.InvalidateRenderColumns(); columnGroupsView.ColumnGroups[0].PinPosition = PinnedColumnPosition.Left; columnGroupsView.ColumnGroups[3].PinPosition = PinnedColumnPosition.Right; } Workaround: do not set the ShowHeader property to false. Use the ViewCellFormatting event to hide to necessary cell borders to simulate cells merging.
To reproduce: ColumnGroupsViewDefinition columnGroupsView; columnGroupsView = new ColumnGroupsViewDefinition(); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup()); columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[0].Rows[0].ColumnNames.Add("colPINNED_LEFT"); columnGroupsView.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[1].Rows[0].ColumnNames.Add("colDATE"); columnGroupsView.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[2].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[2].Rows[0].ColumnNames.Add("colTITLE"); columnGroupsView.ColumnGroups[2].Rows[1].ColumnNames.Add("colTEXT"); columnGroupsView.ColumnGroups[3].Rows.Add(new GridViewColumnGroupRow()); columnGroupsView.ColumnGroups[3].Rows[0].ColumnNames.Add("colPINNED_RIGHT"); this.radGridView1.ViewDefinition = columnGroupsView; this.radGridView1.Columns["colDATE"].Width = 110; this.radGridView1.Columns["colTITLE"].Width = this.radGridView1.Width - 181; this.radGridView1.TableElement.ViewElement.RowLayout.InvalidateRenderColumns(); columnGroupsView.ColumnGroups[0].PinPosition = PinnedColumnPosition.Left; columnGroupsView.ColumnGroups[3].PinPosition = PinnedColumnPosition.Right;
To reproduce: - Set the column like this: GridViewMaskBoxColumn col = new GridViewMaskBoxColumn(); col.Mask = "&&&&&&&&&&"; col.MaskType = MaskType.Standard; col.FieldName = "Name"; col.TextMaskFormat = MaskFormat.IncludeLiterals; - Type two words and press enter. Workaround: public class MyRadMaskedEditBoxEditor : RadMaskedEditBoxEditor { public override object Value { get { if (this.MaskTextBox.Mask == "my mask") { return this.MaskTextBox.Value; } return base.Value; } set { base.Value = value; } } }
Workaround: Subscribe to CellFormatting event: void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) { if (e.CellElement is GridCheckBoxCellElement) { e.CellElement.ToolTipText = "ErrorMessage for CheckBoxColumn"; e.CellElement.Children[0].ToolTipText = "ErrorMessage for CheckBoxColumn"; e.CellElement.Children[0].Children[0].ToolTipText = "ErrorMessage for CheckBoxColumn"; } }
To reproduce: - Add grid with several columns and set their AllowResize property to false. - Set the FitWidthMode to FitPageWidth. - Print the grid and you will notice that some of the columns are cut off. Workaround: - Set the AllowResize property to true before printing.
To reproduce: use the following code snippet and follow the steps in the attached gif file. private void Form1_Load(object sender, EventArgs e) { this.order_DetailsTableAdapter.Fill(this.nwindDataSet.Order_Details); this.ordersTableAdapter.Fill(this.nwindDataSet.Orders); radGridView1.AutoGenerateHierarchy = true; radGridView1.DataSource = this.nwindDataSet; radGridView1.DataMember = "Orders"; radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.MasterTemplate.Templates.First().AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.EnablePaging = true; radGridView1.MasterTemplate.Templates.First().EnableFiltering = true; FilterDescriptor fd = new FilterDescriptor(); fd.PropertyName = "UnitPrice"; fd.Operator = FilterOperator.IsGreaterThan; fd.Value = 40; radGridView1.MasterTemplate.Templates.First().FilterDescriptors.Add(fd); radGridView1.MouseDown += radGridView1_MouseDown; } private void radGridView1_MouseDown(object sender, MouseEventArgs e) { GridDetailViewCellElement detailCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDetailViewCellElement; if (detailCell != null) { radGridView1.MasterTemplate.Templates.First().FilterDescriptors.Clear(); } } Workaround: private void radGridView1_MouseDown(object sender, MouseEventArgs e) { GridDetailViewCellElement detailCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDetailViewCellElement; if (detailCell != null) { radGridView1.MasterTemplate.Templates.First().FilterDescriptors.Clear(); GridViewHierarchyRowInfo hierarchyRow = (GridViewHierarchyRowInfo)((GridViewDetailsRowInfo)detailCell.RowInfo).Owner; hierarchyRow.IsExpanded = ! hierarchyRow.IsExpanded; hierarchyRow.IsExpanded = ! hierarchyRow.IsExpanded; hierarchyRow.ChildRows.Last().EnsureVisible(); } }
To reproduce: - Add grid to a blank form. - Add summary rows and group descriptors. - Add rows upon a button click. - You will notice that not all rows are visible. Workaround: radGridView1.TableElement.Update(GridUINotifyAction.RowHeightChanged, null); radGridView1.TableElement.VScrollBar.Value = radGridView1.TableElement.VScrollBar.Maximum - radGridView1.TableElement.VScrollBar.LargeChange;