By design the MinHeight property is not respected in ColumnGroupsViewDefinition. The right way to apply MinHeight in the ColumnGroupsViewDefinition is setting the GridViewColumnGroup's RowSpanProperty and GridViewColumnGroupRow's MinHeight property. For example: this.columnGroupsView = new ColumnGroupsViewDefinition(); this.columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("General") { RowSpan = 40 }); this.columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup("Details") { RowSpan = 40 }); this.columnGroupsView.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Address") { RowSpan = 40 }); this.columnGroupsView.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Ime Tam") { RowSpan = 40 }); this.columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 40 }); this.columnGroupsView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 40 }); this.radGridView1.Columns["ContactName"].RowSpan = 40; this.columnGroupsView.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["CustomerID"]); this.columnGroupsView.ColumnGroups[0].Rows[0].Columns.Add(this.radGridView1.Columns["ContactName"]); this.columnGroupsView.ColumnGroups[0].Rows[1].Columns.Add(this.radGridView1.Columns["CompanyName"]); this.columnGroupsView.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 40 }); this.columnGroupsView.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["City"]); this.columnGroupsView.ColumnGroups[1].Groups[0].Rows[0].Columns.Add(this.radGridView1.Columns["Country"]); this.columnGroupsView.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 40 }); this.columnGroupsView.ColumnGroups[1].Groups[1].Rows[0].Columns.Add(this.radGridView1.Columns["Phone"]);
When RadGridView is in right to left mode and the data is grouped, the layout of the items that represent the group field names is incorrect - the close button overlays the text. WORKAROUND: public Form83() { new RadControlSpyForm().Show(); InitializeComponent(); this.radGridView1.GroupByChanged += radGridView1_GroupByChanged; } void radGridView1_GroupByChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e) { foreach (GroupFieldElement fieldElement in this.radGridView1.GridViewElement.GroupPanelElement.GetDescendants( delegate(RadElement element) { return element is GroupFieldElement; }, Telerik.WinControls.TreeTraversalMode.BreadthFirst)) { fieldElement.TextAlignment = ContentAlignment.MiddleRight; } }
Steps at design time: 1.Add a RadGridView to the from and change its Dock property to Fill. 2.Change its AutoSizeColumnsMode property to Fill. 3.Chage the Form.Size property to Width = 527 and Height = 346. Use the following code: public Form1() { InitializeComponent(); DataTable dt = new DataTable("Items"); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Description", typeof(string)); dt.Columns.Add("Price", typeof(decimal)); dt.Columns.Add("Supplier", typeof(string)); for (int i = 0; i < 10; i++) { dt.Rows.Add(i, "Description" + i, i * 0.25, "Supplier" + i); } radGridView1.DataSource = dt; } Workaround: set the AutoSizeColumnsMode property to Fill in the Form.Load event: private void Form1_Load(object sender, EventArgs e) { radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; }
To reproduce: public Form1() { InitializeComponent(); radGridView1.ToolTipTextNeeded += radGridView1_ToolTipTextNeeded; } private void radGridView1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e) { GridDataCellElement cell = sender as GridDataCellElement; if (cell != null) { e.ToolTipText = cell.Value.ToString(); toolTipText = e.ToolTipText; e.ToolTip.OwnerDraw = true; e.ToolTip.Draw += ToolTip_Draw; e.ToolTip.Popup += ToolTip_Popup; } } private void ToolTip_Popup(object sender, PopupEventArgs e) { e.ToolTipSize = TextRenderer.MeasureText(toolTipText + " ", newFont); } Font newFont = new Font("Arial", 15f, FontStyle.Bold); string toolTipText = string.Empty; private void ToolTip_Draw(object sender, DrawToolTipEventArgs e) { e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds); e.DrawBorder(); using (StringFormat sf = new StringFormat()) { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Far; sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; sf.FormatFlags = StringFormatFlags.NoClip; e.Graphics.DrawString(e.ToolTipText, newFont, Brushes.Red, e.Bounds, sf); } }
If one sets AutoSizeRows to true and AllowSearchRow to true the layout of RadGridView throws an exception.
To reproduce: Create a form and add a timer with interval of 1 second and in tick handler do the following: void t_Tick(object sender, EventArgs e) { if (this.Controls.Count > 0) { Control oldGrid = this.Controls[0]; this.Controls.RemoveAt(0); oldGrid.Dispose(); GC.Collect(3, GCCollectionMode.Forced); } RadGridView grid = new RadGridView(); grid.Dock = DockStyle.Fill; this.Controls.Add(grid); } You will see that the memory consumption will grow. Workaround: Use the following custom RadGridView public class MyRadGridView : RadGridView { protected override RadGridViewElement CreateGridViewElement() { return new MyElement(); } } public class MyElement : RadGridViewElement { protected override PagingPanelElement CreatePagingPanelElement() { return new MyPagingPanel(); } protected override Type ThemeEffectiveType { get { return typeof(RadGridViewElement); } } } public class MyPagingPanel : PagingPanelElement { protected override void CreateButtonsStripElementChildElements() { base.CreateButtonsStripElementChildElements(); this.ButtonsStripElement.Children.Add(this.ButtonsStripElement.Grip); this.ButtonsStripElement.Children.Add(this.ButtonsStripElement.OverflowButton); this.ButtonsStripElement.Grip.Visibility = this.ButtonsStripElement.OverflowButton.Visibility = ElementVisibility.Collapsed; } protected override void CreateTextBoxStripElementChildElements() { base.CreateTextBoxStripElementChildElements(); this.TextBoxStripElement.Children.Add(this.TextBoxStripElement.Grip); this.TextBoxStripElement.Children.Add(this.TextBoxStripElement.OverflowButton); this.TextBoxStripElement.Grip.Visibility = this.TextBoxStripElement.OverflowButton.Visibility = ElementVisibility.Collapsed; } }
Workaround: void radGridView1_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e) { if (e.Column is GridViewImageColumn && e.Row is GridViewDataRowInfo) { e.PrintCell.DrawFill = true; if (radGridView1.PrintStyle.PrintAlternatingRowColor && e.Row.Index % 2 == 1) { e.PrintCell.BackColor = radGridView1.PrintStyle.AlternatingRowColor; } else { e.PrintCell.BackColor = radGridView1.PrintStyle.CellBackColor; } } }
To reproduce: -Add GridViewMaskBoxColumn to a grid. -Set the Mask type to Regex and set any mask you want. -When you leave the cell NullRefernceException is thrown.
To reproduce: - Add GridViewComboBoxColumn to a grid. - Set the DisplayMemeber property like this: column1.DisplayMember = "AddInfo.Status";
DECLINED: this happens only when the double click is outside the bounds of the scroll button which is the expected behavior. To reproduce: When the user clicks too fast on the quite thin area between the grid's scroll-bar arrow button and the row, it fires the CurrentRowChanging event. Workaround: private bool cancelChanging = false; private void radGridView1_CurrentRowChanging(object sender, CurrentRowChangingEventArgs e) { if (cancelChanging) { e.Cancel = true; cancelChanging = false; } } private void radGridView1_MouseDoubleClick(object sender, MouseEventArgs e) { cancelChanging = false; RadElement element = this.radGridView1.Behavior.GetHoveredRadElement(); while (element != null) { if (element.GetType() == typeof(RadScrollBarElement)) { cancelChanging = true; break; } element = element.Parent; } }
Setting the DataSource is slower (about 1/3 times more) when ShowColumnHeaders is set to true. Workaround: Set the ShowColumnHeaders to false, then set the DataSource and restore the ShowColumnHeaders state: radGridView1.ShowColumnHeaders = false; radGridView1.DataSource = mySource; radGridView1.ShowColumnHeaders = true;
This issue appears when one clears the relations collection of RadGridView, it appears sporadically and in rare cases
Extend the cell elements with a button(s) (via decorator for example) which will be visible without putting the grid in edit mode. The buttons should not be visible by default and their visibility will be controlled via property of the column. These buttons can be RadButtonElements which will not hurt the performance. Their purpose will be to inform the end user that some cell is a combo or a date time cell without having to open its editor in advance. When the button is clicked, the corresponding action should be executed e.g. for combo cell, open the editor and show the popup; for spin cell open the editor and perform the click of the desired button. Same goes for the rest of the editors - mccb, color, browse, date time, etc.
Workaround: Me.RadGridView1.Columns("ProductName").TextAlignment = ContentAlignment.MiddleRight
FIX. RadGridView - cannot show tooltips in GridViewComboBoxColumn, while in RadDropDownList the tooltips work correctly
If you dispose the grid or the form it is placed on the grid's DoubleClick, MouseDoubleClick, MouseDown, etc. events, an exception is thrown.
To reproduce: - Add RadGridView to a blank project and bind it to a blank binding source. - Add GridViewMultiComboBoxColumn to the grid and bind it to another binding source. - In the CellEditorInitialized set the autocomplete mode to Suggest. - When you start the application you will notice that the first items is selected but not displayed and to display it you should select other value first and you will be able to select the first one. Workaround: Set the selected item of the editor to null in the CellEditorInitialized event.
Steps to reproduce: 1. Add a RadGridView with one column and one row to a form 2. Set the value of the only data cell in the grid to a string containing more than 32 'a' characters 3. Type 'a' in the search row. You will see an OverflowException
To reproduce: DataTable t = new DataTable(); t.Columns.Add("timeSpan", typeof(TimeSpan)); t.Rows.Add(TimeSpan.FromHours(11)); t.Rows.Add(TimeSpan.FromHours(2)); t.Rows.Add(TimeSpan.FromHours(4)); t.Rows.Add(TimeSpan.FromMinutes(17)); radGridView1.DataSource = t; GridViewSummaryItem summaryItem = new GridViewSummaryItem(); summaryItem.Name = "timeSpan"; summaryItem.Aggregate = GridAggregateFunction.Sum; GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem(); summaryRowItem.Add(summaryItem); this.radGridView1.SummaryRowsTop.Add(summaryRowItem); Workaround: CustomSummaryItem summaryItem = new CustomSummaryItem("timeSpan", "", GridAggregateFunction.Sum); GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem(); summaryRowItem.Add(summaryItem); this.radGridView1.SummaryRowsTop.Add(summaryRowItem); public class CustomSummaryItem : GridViewSummaryItem { public CustomSummaryItem(string name, string formatString, GridAggregateFunction aggregate) : base(name, formatString, aggregate) { } public override object Evaluate(IHierarchicalRow row) { TimeSpan timeSpanSum = new TimeSpan(); foreach (GridViewRowInfo childRow in row.ChildRows) { timeSpanSum += (TimeSpan)childRow.Cells["timeSpan"].Value; } return timeSpanSum; } }