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; }
How to reproduce: public partial class Form1 : Form { DataTable dt; public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; } private void radButton1_Click(object sender, EventArgs e) { dt.Clear(); for (int i = 0; i < 100; i++) { dt.Rows.Add(i, "New Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } } private DataTable GetData() { dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 500; i++) { dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } return dt; } } Workaround: public partial class Form1 : Form { DataTable dt; public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.RowsChanged += RadGridView1_RowsChanged; } private void RadGridView1_RowsChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Reset) { this.radGridView1.MasterView.PinnedRows.GetType().GetMethod("Clear", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) .Invoke(this.radGridView1.MasterView.PinnedRows, new object[] { }); } } private void radButton1_Click(object sender, EventArgs e) { dt.Clear(); for (int i = 0; i < 100; i++) { dt.Rows.Add(i, "New Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } } private DataTable GetData() { dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 500; i++) { dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } return dt; } }
To reproduce: - Add default values for all cells in the grid. - Try to add the new row without changing any value. Workaround: private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { var editor = radGridView1.ActiveEditor as BaseInputEditor; var field = editor.GetType().GetField("originalValue", BindingFlags.NonPublic | BindingFlags.Instance); field.SetValue(editor, "asd"); }
To reproduce: please refer to the attached sample project and gif file illustrating the behavior. Workaround: in order to cancel adding of the new row, you can call the MasterView.TableAddNewRow.CancelAddNewRow method: private void radGridView1_UserAddingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e) { e.Cancel = true; this.radGridView1.MasterView.TableAddNewRow.CancelAddNewRow(); int index = this.radGridView1.Rows.Count; this.radGridView1.Rows.Add(index, "Row" + index); }
To reproduce: please refer to the attached sample project. Workaround: this.radGridView1.TableElement.ScrollToRow(this.radGridView1.RowCount-1);
Please refer to the attached sample project and gif file illustrating the problem. Workaround: Sub New() InitializeComponent() AddHandler Me.RadGridView1.CreateCell, AddressOf RadGridView_CreateCell End Sub Public Class CustomGridFilterCellElement Inherits GridFilterCellElement Protected Overrides ReadOnly Property ThemeEffectiveType() As Type Get Return GetType(GridFilterCellElement) End Get End Property Public Sub New(column As GridViewDataColumn, row As GridRowElement) MyBase.New(column, row) End Sub Protected Overrides Function ApplyFormatString(value As Object) As String Return CDate(value).ToString("dd.MM.yyyy") End Function End Class
GridViewSpreadExport does not export correctly more than one child templates from second level.
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"); }
Steps to reproduce: 1. Add a CompositeFilterDescriptor programmatically as it is demonstrated in the following help article: http://docs.telerik.com/devtools/winforms/gridview/filtering/setting-filters-programmatically-(composite-descriptors) 2. Save the layout. 3. Load the layout. Use attached project to reproduce. Workaround: Seth te PropertyName to a valid column name.
Steps to reproduce: 1. Add a CompositeFilterDescriptor programmatically as it is demonstrated in the following help article: http://docs.telerik.com/devtools/winforms/gridview/filtering/setting-filters-programmatically-(composite-descriptors) 2. Save the layout. 3. Load the layout. Workaround: specify the PropertyName property for the CompositeFilterDescriptor.
To reproduce: public class Item { public int Id { get; set; } public string Name { get; set; } public DateTime Date { get; set; } public Item(int id, string name, DateTime date) { this.Id = id; this.Name = name; this.Date = date; } } public Form1() { InitializeComponent(); List<Item> items = new List<Item>(); for (int i = 0; i < 10; i++) { items.Add(new Item(i,"Item" + i,DateTime.Now.AddHours(i))); } this.radGridView1.DataSource = items; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; } private void Form1_Load(object sender, EventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB"); this.radGridView1.Columns["Date"].ExcelExportFormatString = "M/d/yyyy h:mm tt"; this.radGridView1.Columns["Date"].ExcelExportType = DisplayFormatType.Custom; GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1); spreadExporter.ExportVisualSettings = true; SpreadExportRenderer exportRenderer = new SpreadExportRenderer(); string fileName = @"..\..\exportedFile" + DateTime.Now.ToLongTimeString().Replace(":", "_") + ".xlsx"; spreadExporter.RunExport(fileName, exportRenderer); Process.Start(fileName); }
Currently, it is only possible to define two filter conditions in the Custom Filter Dialog. It would be better if there is possibility for adding multiple filter conditions, similar to the possibility given by the Conditional Formatting Dialog
How to reproduce: check the attached video as well public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 10; i++) { dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } return dt; } private void radButton1_Click(object sender, EventArgs e) { this.radGridView1.TableElement.ScrollToRow(0); this.radGridView1.Focus(); } } Workaround: call the method if the row is not selected private void radButton1_Click(object sender, EventArgs e) { if (!this.radGridView1.Rows[0].IsSelected) { this.radGridView1.TableElement.ScrollToRow(0); } this.radGridView1.Focus(); }
AutoSizeRows is not currently supported.