Row reorder feature not work in unbound mode RadGridView with self-reference hierarchy
When the RadGridView is bind to a data source, which contains a flagged enum, an instance of GridViewComboBoxColumn should be added and its editor should be checked drop down list.
Currently the mixed hierarchy mode does not work for child templates
IMPROVE. Extend the functionality of formatting the group text when grouping by more than one column is performed on the same group level
When you are using drop down list in RadGridView in suggest-append mode, you should be allowed to add non-existing item to the data source.
To reproduce: 1. Run the attached sample project. 2. Move the form to the right bottom of the screen. 3. Hover a cell to show the tool tip. It will start blinking. Please refer to the attached gif file. Workaround: use screen tips: http://docs.telerik.com/devtools/winforms/telerik-presentation-framework/tooltips-and-screentips/screen-tips
To reproduce: 1. Add a RadGridView with a GridViewCheckBoxColumn and enable the paging functionality for it. 2. Toggle the header checkbox on the first page. Only the rows from the page are toggled. Workaround: you can subscribe to the HeaderCellToggleStateChanged event and toggle all rows: private void radGridView1_MouseUp(object sender, MouseEventArgs e) { if (this.radGridView1.Tag+""=="toggle") { this.radGridView1.Tag = null; this.radGridView1.HeaderCellToggleStateChanged -= radGridView1_HeaderCellToggleStateChanged; } } private void radGridView1_MouseDown(object sender, MouseEventArgs e) { RadCheckBoxElement element = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as RadCheckBoxElement; if (element != null && element.Parent is GridCheckBoxHeaderCellElement) { this.radGridView1.Tag = "toggle"; this.radGridView1.HeaderCellToggleStateChanged += radGridView1_HeaderCellToggleStateChanged; } } private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e) { this.radGridView1.BeginUpdate(); foreach (GridViewRowInfo row in this.radGridView1.Rows) { row.Cells["Discontinued"].Value = e.State; } this.radGridView1.EndUpdate(); }
To reproduce: run the attached sample project and group by the Id column. Workaround: use the ViewCellFormatting event to populate the missing values or use a custom GridViewSummaryItem and override the Evaluate method in order to achieve the desired calculation.
Use the attached project to reproduce. - Start the project and group by any column and export the grid. - The same code works finme if the document is imported. Workaround: Edit the document after it is exported: var provider = new XlsxFormatProvider(); var workbook = new Workbook(); using (var stream = File.OpenRead(@"D:\123.xlsx")) { workbook = provider.Import(stream); } PatternFill solidPatternFill = new PatternFill(PatternType.Solid, System.Windows.Media.Color.FromRgb(46, 204, 113), Colors.Transparent); CellValueFormat textFormat = new CellValueFormat("@"); Worksheet sheet = workbook.ActiveWorksheet; CellRange range = new CellRange(0, 0, 1, 4); CellSelection header = sheet.Cells[range]; if (header.CanInsertOrRemove(range, ShiftType.Down)) { header.Insert(InsertShiftType.Down); } header.Merge(); header.SetFormat(textFormat); header.SetFontFamily(new ThemableFontFamily("Rockwell")); header.SetFontSize(24); header.SetHorizontalAlignment(Telerik.Windows.Documents.Spreadsheet.Model.RadHorizontalAlignment.Center); header.SetVerticalAlignment(Telerik.Windows.Documents.Spreadsheet.Model.RadVerticalAlignment.Center); header.SetFill(solidPatternFill); header.SetValue("Test"); using (var stream = File.OpenWrite("result.xlsx")) { provider.Export(workbook, stream); } Process.Start("result.xlsx");
Until released one can format the nodes this way: private void RadGridView1_FilterPopupRequired(object sender, Telerik.WinControls.UI.FilterPopupRequiredEventArgs e) { if (e.Column.GetType().Name == "GridViewDateTimeColumn") { RadListFilterPopup popup = new RadListFilterPopup(e.Column, true); e.FilterPopup = popup; popup.MenuTreeElement.TreeView.NodeFormatting += TreeView_NodeFormatting; } } int monthNumber = -1; private void TreeView_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { if (e.Node.Level == 2) { if (int.TryParse(e.Node.Text, out monthNumber)) { e.NodeElement.ContentElement.Text = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(monthNumber); } } }
To reproduce: please refer to the attached gif file. 1. Run the attached sample project. 2. Toggle the checkbox and scroll to a specific row. 3. Click the button to hide a column. You will notice that the vertical scrollbar changes its position. If the AutoSizeRows property is set to false, the scrollbar keeps its position. Workaround: private void radToggleButton1_ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args) { int scrollBarValue = this.radGridView1.TableElement.VScrollBar.Value; bool visible = true; if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { visible = false; } this.radGridView1.MasterTemplate.BeginUpdate(); for (int i = 1; i < this.radGridView1.Columns.Count; i += 2) { this.radGridView1.Columns[i].IsVisible = visible; } this.radGridView1.MasterTemplate.EndUpdate(); this.radGridView1.TableElement.VScrollBar.Value = scrollBarValue; }
Workaround: private void RadForm1_Load(object sender, EventArgs e) { this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); this.productsTableAdapter.Fill(this.nwindDataSet.Products); radGridView1.AutoGenerateHierarchy = true; radGridView1.DataSource = this.nwindDataSet; radGridView1.DataMember = "Categories"; radGridView1.Rows[0].IsExpanded = !radGridView1.Rows[0].IsExpanded; radGridView1.Rows[0].IsExpanded = !radGridView1.Rows[0].IsExpanded; } Image expandedSign; Image collapsedSign; private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { GridGroupExpanderCellElement expanderCell = e.CellElement as GridGroupExpanderCellElement; if (expanderCell != null) { if (expandedSign == null && expanderCell.Expander.SignImage != null && e.Row.IsExpanded == false) { expandedSign = expanderCell.Expander.SignImage.Clone() as Image; } if (collapsedSign == null && expanderCell.Expander.SignImage != null && e.Row.IsExpanded == true) { collapsedSign = expanderCell.Expander.SignImage.Clone() as Image; } if (expandedSign != null && collapsedSign != null) { expanderCell.Expander.SignImage = null; } if (e.Row.IsExpanded) { expanderCell.Expander.Image = collapsedSign; } else { expanderCell.Expander.Image = expandedSign; } expanderCell.Expander.ImageLayout = ImageLayout.None; expanderCell.Expander.DrawImage = true; expanderCell.Expander.ImageAlignment = ContentAlignment.TopLeft; } }
Please refer to the attached sample project and follow the steps in the gif file. 1. Open two MDI child forms. 2. Activate the first form and right click on the grid in order to show the context menu and add a shortcut to the menu item. Press Ctrl+N in order to add some new rows to the first grid. 3. Activate the second form and right click on the grid in order to show the context menu and add a shortcut to the menu item. Press Ctrl+N in order to add some new rows to the second grid. However, you will notice that the first several shortcuts combinations are executed for the first grid and then for the active second grid. Workaround: clear the shortcut when the form is deactivated: this.Deactivate += GridForm_Deactivate; private void GridForm_Deactivate(object sender, EventArgs e) { item.Shortcuts.Clear(); } private void GridForm_Activated(object sender, EventArgs e) { this.ActiveControl = this.radGridView1; } RadMenuItem item = new RadMenuItem(); private void radGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e) { item.Text = "insert row"; item.Shortcuts.Add(new RadShortcut(Keys.Control, Keys.N)); item.Click += item_Click; e.ContextMenu.Items.Add(item); }
To reproduce: please refer to the attached sample project and follow the described steps in the .doc file located in the zip. Workaround: protected override void OnActivated(EventArgs e) { base.OnActivated(e); this.ActiveControl = this.gvDetails; } private void gvDetails_LostFocus(object sender, EventArgs e) { ((ComponentBehavior)gvDetails.Behavior).GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Instance); PropertyInfo barProperty = ((ComponentBehavior)gvDetails.Behavior).GetType().GetProperty("ScreenPresenter", BindingFlags.NonPublic | BindingFlags.Instance); Form screenTip = barProperty.GetValue(((ComponentBehavior)gvDetails.Behavior), null) as Form; screenTip.Hide(); }
To reproduce: run the attached sample project and you will notice that the top border is missing as it is illustrated in the screenshot. Workaround: set the RadGridView.AutoSizeRows property to false.
Steps to reproduce: 1. Add RadGridView and populate with data 2. Show the context menu many times. Sometimes the popup is not shown correctly. If you click again, the popup is visible correctly. Workaround: Set the AnimationEnabled property to false or the AnimationType property to None. Here is the code snippet how can be achieve it: //Set the AnimationEnabled to false void radGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e) { RadDropDownMenu contextMenu = e.ContextMenu as RadDropDownMenu; contextMenu.AnimationEnabled = false; } //Set the AnimationType to None void radGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e) { RadDropDownMenu contextMenu = e.ContextMenu as RadDropDownMenu; contextMenu.AnimationType = PopupAnimationTypes.None; }
To reproduce: public RadForm1() { InitializeComponent(); radGridView1.DataSource = GetTable(); GridViewSummaryItem summaryItem = new GridViewSummaryItem(); summaryItem.Name = "Name"; summaryItem.Aggregate = GridAggregateFunction.Count; GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem(); summaryRowItem.Add(summaryItem); this.radGridView1.SummaryRowsBottom.Add(summaryRowItem); radGridView1.ViewCellFormatting += RadGridView1_ViewCellFormatting; } private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { if (e.CellElement is GridSummaryCellElement) { e.CellElement.DrawFill = true; e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid; e.CellElement.BackColor = Color.Red; } else { e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local); e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local); e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local); } } protected override void OnLoad(EventArgs e) { base.OnLoad(e); radGridView1.MasterView.SummaryRows[0].PinPosition = PinnedRowPosition.Bottom; } static DataTable GetTable() { DataTable table = new DataTable(); table.Columns.Add("Dosage", typeof(int)); table.Columns.Add("Drug", typeof(string)); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Date", typeof(DateTime)); for (int i = 0; i < 5; i++) { table.Rows.Add(25, "Indocin", "David", DateTime.Now); table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now); table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now); table.Rows.Add(21, "Combivent", "Janet", DateTime.Now); table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now); } return table; } private void radButton1_Click(object sender, EventArgs e) { radGridView1.SaveLayout("test.xml"); } private void radButton2_Click(object sender, EventArgs e) { radGridView1.SummaryRowsBottom.Clear(); radGridView1.SummaryRowsTop.Clear(); radGridView1.LoadLayout("test.xml"); }
The problematic themes are: Aqua HighContrastBlack VisualStudio2012Dark VisualStudio2012Light Windows8 How to reproduce: private void RadForm1_Load(object sender, EventArgs e) { var theme = new Windows8Theme(); ThemeResolutionService.ApplicationThemeName = "Windows8"; GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.Name = "Test"; this.radGridView1.Columns.Add(textBoxColumn); for (int i = 0; i < 100; i++) { this.radGridView1.Rows.AddNew(); } } Workaround: private void RadForm1_Load(object sender, EventArgs e) { var theme = new Windows8Theme(); ThemeResolutionService.ApplicationThemeName = "Windows8"; GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.Name = "Test"; this.radGridView1.Columns.Add(textBoxColumn); this.radGridView1.BeginUpdate(); for (int i = 0; i < 100; i++) { this.radGridView1.Rows.AddNew(); } this.radGridView1.EndUpdate(); int lastRow = this.radGridView1.Rows.Count - 1; this.radGridView1.Rows[lastRow].IsCurrent = true; }
Use the attached project to reproduce. Workaround: Set the MaxWidth/MinWidth of the column manually.