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.
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); this.radGridView1.AutoGenerateColumns = false; this.radGridView1.DataSource = this.productsBindingSource; GridViewComboBoxColumn col = new GridViewComboBoxColumn(); col.DataSource = this.categoriesBindingSource; col.MinWidth = 200; col.DisplayMember = "Description"; col.ValueMember = "CategoryID"; this.radGridView1.Columns.Add(col); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.CellValueChanged += radGridView1_CellValueChanged; } private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e) { string value = "{nothing}"; if (e.Value != null) { value = Convert.ToString(e.Value); } RadMessageBox.Show("CellValueChanged. Value >> " + value); } Note: if the cell value is not null, the CellValueChanged event is not fired when the selection in drop down is not changed. Additional scenario: if you use a RadMultiColumnComboBoxElement for this column replaced in the EditorRequired, the issue is reproducible again.
Workaround: Inherit the GridViewSearchRowInfo and override the SelectNextSearchResult method class MyGridViewSearchRowInfo : GridViewSearchRowInfo { private GridViewInfo gridViewInfo; private RadGridView radGridView; public MyGridViewSearchRowInfo(GridViewInfo gridViewInfo, RadGridView radGridView) : base(gridViewInfo) { this.radGridView = radGridView; } public override Type RowElementType { get { return typeof(GridSearchRowElement); } } public override void SelectNextSearchResult() { if (this.radGridView != null) { this.radGridView.ElementTree.Control.Invoke(() => { base.SelectNextSearchResult(); }); } } }
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.
To reproduce use the attached project. Workaround: Private Sub gvData_UserAddedRow(sender As Object, e As Telerik.WinControls.UI.GridViewRowEventArgs) Handles gvData.UserAddedRow Dim pi = GetType(GridViewNewRowInfo).GetProperty("MoveToLastRow", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic) pi.SetValue(Me.gvData.MasterView.TableAddNewRow, True, Nothing) End Sub
Consider the case where there are many child views and you want to export only the ones that actually contain data. Currently, you can either export only one view or all. One should be able to pass all the views in the ChildViewExporting event.
To reproduce: - Bind the grid to an object that contains enum property. - Save the layout - Restart the application and load the layout before setting the DataSource of the grid. Workaround: Load the layout after the DataSource is set.