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;
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Age", typeof(int)); 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, i + 10, DateTime.Now.AddMinutes(i), i % 2 == 0 ? true : false); } return dt; } private void radButton1_Click(object sender, EventArgs e) { this.radGridView1.Columns[1].Expression = "Id * Age"; } private void radButton2_Click(object sender, EventArgs e) { string s = "default.xml"; SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; dialog.Title = "Select a xml file"; if (dialog.ShowDialog() == DialogResult.OK) { s = dialog.FileName; } this.radGridView1.SaveLayout(s); } private void radButton3_Click(object sender, EventArgs e) { string s = "default.xml"; OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; dialog.Title = "Select a xml file"; if (dialog.ShowDialog() == DialogResult.OK) { s = dialog.FileName; } this.radGridView1.LoadLayout(s); } } Workaround: iterate the columns prior to loading the layout and remove the expressions private void radButton3_Click(object sender, EventArgs e) { foreach (GridViewDataColumn col in this.radGridView1.Columns) { col.Expression = ""; } string s = "default.xml"; OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; dialog.Title = "Select a xml file"; if (dialog.ShowDialog() == DialogResult.OK) { s = dialog.FileName; } this.radGridView1.LoadLayout(s); }
To reproduce: 1. Drag and drop RadGridView 2. Open Property Builder 3. Add a column and select it 4. Open Settings tab and you will see that there are two ampersand symbols 5. Add template or select Master Template and you will see that there are two ampersand symbols
To reproduce: - Set the grid properties as follows: radGridView1.MasterTemplate.AllowAddNewRow = false; radGridView1.MasterTemplate.AllowDeleteRow = false; radGridView1.MasterTemplate.AllowDragToGroup = false; radGridView1.MasterTemplate.AllowEditRow = false; radGridView1.MasterTemplate.EnableFiltering = true; radGridView1.MasterTemplate.EnableGrouping = false; radGridView1.MasterTemplate.MultiSelect = true; - Start the application and drag the filter button without releasing the mouse button. Workaround: class MyGridFilterRowBehavior : GridFilterRowBehavior { protected override bool ProcessMouseSelection(Point mousePosition, GridCellElement currentCell) { if (currentCell is GridFilterCellElement) { return false; } return base.ProcessMouseSelection(mousePosition, currentCell); } } BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewFilteringRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewFilteringRowInfo), new MyGridFilterRowBehavior());
To reproduce: - Add some columns to a grid. - Then add a column like this: private void button2_Click(object sender, System.EventArgs e) { radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; Telerik.WinControls.UI.GridViewDataColumn gridViewColumn2 = new Telerik.WinControls.UI.GridViewCheckBoxColumn(); gridViewColumn2.MinWidth = gridViewColumn2.MaxWidth = 22; gridViewColumn2.Width = 100; radGridView1.MasterTemplate.Columns.Add(gridViewColumn2); gridViewColumn2.MinWidth = 0; gridViewColumn2.MaxWidth = 0; } Please note that if you add two columns with the above code, you will be able to resize the first one, but the cursor position is in wrong position. Workaround: - Set the MaxWidth before adding the column to the grid.
Please refer to the attached gif file. Workaround: this.radGridView1.GridBehavior = new CustomBaseGridBehavior(); public class CustomBaseGridBehavior : BaseGridBehavior { public override bool OnMouseMove(MouseEventArgs e) { GroupPanelSizeGripElement grip = this.GridViewElement.ElementTree.GetElementAtPoint(e.Location) as GroupPanelSizeGripElement; if (grip != null) { this.GridViewElement.ElementTree.Control.Cursor = Cursors.SizeNS; return true; } return base.OnMouseMove(e); } }
To reproduce: - Use RadDock with MDI mode. - Add a form that contains a grid. - Set the theme to Aqua. Workaround: grid.GridViewElement.ForeColor = Color.Black;