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: - Crete a self-reference hiearchy and show the grid lines. - Start the application expand some rows scroll to the bottom and then scroll to the right. - The issue is easily reproducible with the example from the documentation. Workaround: class MyDataCellElement : GridDataCellElement { public MyDataCellElement(GridViewColumn col, GridRowElement row) : base(col, row) { } protected override SizeF ArrangeOverride(SizeF finalSize) { SelfReferenceCellLayout selfReferenceLayout = this.SelfReferenceLayout; if (selfReferenceLayout != null) { GridDataRowElement dataRowElement = this.RowElement as GridDataRowElement; if (dataRowElement != null && this.ColumnInfo.OwnerTemplate != null) { dataRowElement.SelfReferenceLayout.StackLayoutElement.Visibility = ElementVisibility.Visible; } } else { GridDataRowElement dataRowElement = this.RowElement as GridDataRowElement; if (dataRowElement != null && this.ColumnInfo.OwnerTemplate != null) { dataRowElement.SelfReferenceLayout.StackLayoutElement.Visibility = ElementVisibility.Collapsed; } } return base.ArrangeOverride(finalSize); } protected override Type ThemeEffectiveType { get { return typeof(GridDataCellElement); } } }
How to reproduce: Create a grid in self referencing hierarchy and set up a filter expression like this: this.radGridView1.FilterDescriptors.Expression = "Name = \"bin\" AND (FileSystemInfoType = \"Folder\" OR Id = \"2\")" Immediately after the expression is set, the OR logical operator is substituted with AND
To reproduce: - Show a message box in the CellValidating event handler. - Start the application, edit a cell and directly press the vertical scroll bottom arrow.
To reproduce: 1 - Add a grid view in a form. 2 - Add 14 - 17 records in grid view. 3 - Allow alternating color for grid view. 4 - Do sorting by clicking on header column (click 3 times). 5 - Alternating color display wrong position. Workaround: void radGridView1_SortChanged(object sender, GridViewCollectionChangedEventArgs e) { foreach (GridRowElement row in this.radGridView1.TableElement.ViewElement.ScrollableRows.Children) { row.Synchronize(); } }
To reproduce: public RadForm1() { InitializeComponent(); Controls.Add(new RadGridView { Dock = DockStyle.Fill, ShowHeaderCellButtons = true, ReadOnly = true, AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill, EnableFiltering = true, DataSource = Enumerable.Range(0, 24000) //Increase this number when you can't reproduce this issue .Select(x => new { Name = string.Format("Item {0}", x) }), }); } Workaround: class MyListFillter : RadListFilterPopup { public MyListFillter(GridViewDataColumn column, bool groupDateValues) : base(column, groupDateValues) { } protected override void OnButtonOkClick(EventArgs e) { FilterOperator filterOperator = FilterOperator.IsEqualTo; var listFilterElement = typeof(RadListFilterPopup).GetField("listFilterElement", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this) as FilterMenuTreeElement; switch (listFilterElement.SelectedMode) { case ListFilterSelectedMode.All: filterOperator = FilterOperator.None; break; case ListFilterSelectedMode.Null: filterOperator = FilterOperator.IsNull; break; case ListFilterSelectedMode.NotNull: filterOperator = FilterOperator.IsNotNull; break; } if (filterOperator != FilterOperator.IsEqualTo) { SetFilterOperator(filterOperator); this.ClosePopup(RadPopupCloseReason.CloseCalled); } else { CompositeFilterDescriptor compositeFilterDescriptor = new CompositeFilterDescriptor(); compositeFilterDescriptor.PropertyName = base.DataColumn.Name; compositeFilterDescriptor.LogicalOperator = FilterLogicalOperator.Or; if (listFilterElement.SelectedValues.Count > this.GetDistinctValuesTable().Count / 2) { foreach (DictionaryEntry entry in this.GetDistinctValuesTable()) { if (!listFilterElement.SelectedValues.Contains(entry.Key)) { foreach (object value in (ArrayList)entry.Value) { FilterDescriptor descriptor; if (base.DataColumn is GridViewDateTimeColumn || base.DataColumn.DataType == typeof(DateTime) || base.DataColumn.DataType == typeof(DateTime?)) { descriptor = new DateFilterDescriptor(base.DataColumn.Name, FilterOperator.IsNotEqualTo, (DateTime?)value, false); } else { descriptor = new FilterDescriptor(base.DataColumn.Name, FilterOperator.IsNotEqualTo, value); } compositeFilterDescriptor.FilterDescriptors.Add(descriptor); } } } } else { foreach (DictionaryEntry entry in listFilterElement.SelectedValues) { foreach (object value in (ArrayList)entry.Value) { FilterDescriptor descriptor; if (base.DataColumn is GridViewDateTimeColumn || base.DataColumn.DataType == typeof(DateTime) || base.DataColumn.DataType == typeof(DateTime?)) { descriptor = new DateFilterDescriptor(base.DataColumn.Name, FilterOperator.IsEqualTo, (DateTime?)value, false); } else { descriptor = new FilterDescriptor(base.DataColumn.Name, FilterOperator.IsEqualTo, value); } compositeFilterDescriptor.FilterDescriptors.Add(descriptor); } } } base.FilterDescriptor = compositeFilterDescriptor; OnFilterConfirmed(); } } }
To reproduce: - Add logo in the header and export the document. Workaround: void exporter_HeaderExported(object sender, ExportEventArgs e) { PdfEditor ed = e.Editor as PdfEditor; using (MemoryStream ms = new MemoryStream()) { System.Drawing.Image.FromFile(@"C:\img\delete.png").Save(ms, System.Drawing.Imaging.ImageFormat.Png); ed.TranslatePosition(e.Rectangle.Width - 30, e.Rectangle.Y); ed.DrawImage(ms, new System.Windows.Size(30,30)); } }
To reproduce: use the following code snippet and click the button twice. private DataTable GetTable01() { DataTable table = new DataTable(); table.Columns.Add("Dosage", typeof(int)); table.Columns.Add("Drug", typeof(string)); table.Columns.Add("Patient", typeof(string)); table.Columns.Add("Date", typeof(DateTime)); // Here we add five DataRows. 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 button1_Click_1(object sender, EventArgs e) { DataTable table01 = GetTable01(); radGridView1.Rows.Clear(); radGridView1.DataSource = table01; } WORKAROUND I: this.radGridView1.DataError += radGridView1_DataError; private void radGridView1_DataError(object sender, GridViewDataErrorEventArgs e) { if (e.Exception is ArgumentException && e.Exception.Message == "Cannot clear this list.") { this.radGridView1.BeginUpdate(); while (this.radGridView1.Rows.Count > 0) { this.radGridView1.Rows.RemoveAt(0); } this.radGridView1.EndUpdate(); } } WORKAROUND II: while (this.radGridView1.Rows.Count > 0) { this.radGridView1.Rows.RemoveAt(this.radGridView1.Rows.Count - 1); }
To reproduce: use the following code snippet and try to filter the second column: public Form1() { InitializeComponent(); this.radGridView1.Columns.Add("Id"); GridViewDateTimeColumn dateTimeColumn = new GridViewDateTimeColumn(); dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date; dateTimeColumn.Name = "NullDateTimeColumn"; dateTimeColumn.HeaderText = "Order date"; dateTimeColumn.FieldName = "OrderDate"; dateTimeColumn.FormatString = "{0:dd/MM/yyyy}"; this.radGridView1.Columns.Add(dateTimeColumn); dateTimeColumn = new GridViewDateTimeColumn(); dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date; dateTimeColumn.Name = "DateTimeColumn"; dateTimeColumn.HeaderText = "Not Null Date date"; dateTimeColumn.FieldName = "NotNullDate"; dateTimeColumn.FormatString = "{0:dd/MM/yyyy}"; this.radGridView1.Columns.Add(dateTimeColumn); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; for (int i = 0; i < 50; i++) { if (i % 2 == 0) { this.radGridView1.Rows.Add(new object[] { i, null, DateTime.Today }); } else { this.radGridView1.Rows.Add(new object[] { i, DateTime.Now.AddDays(i), DateTime.Today }); } } this.radGridView1.EnableFiltering = true; this.radGridView1.MasterTemplate.ShowHeaderCellButtons = true; this.radGridView1.MasterTemplate.ShowFilteringRow = false; } private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e) { e.FilterPopup = new RadListFilterPopup(e.Column, true); } Workaround: use a specific DateTime value instead of null (e.g. 1/1/1800) and use the CellFormatting event to clear the displayed text. Afterwards, in the RadListFilterPopup it is necessary to hide the text for the null value date nodes: public Form1() { InitializeComponent(); this.radGridView1.Columns.Add("Id"); GridViewDateTimeColumn dateTimeColumn = new GridViewDateTimeColumn(); dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date; dateTimeColumn.Name = "NullDateTimeColumn"; dateTimeColumn.HeaderText = "Order date"; dateTimeColumn.FieldName = "OrderDate"; dateTimeColumn.FormatString = "{0:dd/MM/yyyy}"; this.radGridView1.Columns.Add(dateTimeColumn); dateTimeColumn = new GridViewDateTimeColumn(); dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date; dateTimeColumn.Name = "DateTimeColumn"; dateTimeColumn.HeaderText = "Not Null Date date"; dateTimeColumn.FieldName = "NotNullDate"; dateTimeColumn.FormatString = "{0:dd/MM/yyyy}"; this.radGridView1.Columns.Add(dateTimeColumn); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; for (int i = 0; i < 50; i++) { if (i % 2 == 0) { this.radGridView1.Rows.Add(new object[] { i, new DateTime(1800, 1, 1), DateTime.Today }); } else { this.radGridView1.Rows.Add(new object[] { i, DateTime.Now.AddDays(i), DateTime.Today }); } } this.radGridView1.EnableFiltering = true; this.radGridView1.MasterTemplate.ShowHeaderCellButtons = true; this.radGridView1.MasterTemplate.ShowFilteringRow = false; } private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e) { RadListFilterPopup popup = new RadListFilterPopup(e.Column, true); e.FilterPopup = popup; popup.PopupOpened += popup_PopupOpened; } private void popup_PopupOpened(object sender, EventArgs args) { RadListFilterPopup popup = sender as RadListFilterPopup; if (popup != null) { popup.MenuTreeElement.TreeView.NodeFormatting += TreeView_NodeFormatting; popup.MenuTreeElement.TreeView.Focus(); } } private void TreeView_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { if (e.NodeElement.ContentElement.Text.Contains("1800")) { e.NodeElement.ContentElement.DrawText = false; e.NodeElement.ExpanderElement.Opacity = 0; e.NodeElement.ExpanderElement.ShouldHandleMouseInput = false; e.NodeElement.ShouldHandleMouseInput = false; } else { e.NodeElement.ContentElement.DrawText = true; e.NodeElement.ExpanderElement.Opacity = 1; e.NodeElement.ExpanderElement.ShouldHandleMouseInput = true; e.NodeElement.ShouldHandleMouseInput = true; } } private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) { GridViewDateTimeColumn dtCol = e.Column as GridViewDateTimeColumn; if (e.Row is GridViewDataRowInfo && dtCol != null && ((DateTime)e.CellElement.Value).Year == 1800) { e.CellElement.Text = string.Empty; } }
Workaround this.radGridView1.Templates["MyEmptyTemplate"]..AddNewRowPosition = SystemRowPosition.Top Then handle the ViewCellFormatting event and get notifications when the hierarchy tabs are being clicked. private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { GridDetailViewCellElement detailCell = e.CellElement as GridDetailViewCellElement; if (detailCell != null) { detailCell.PageViewElement.ItemSelected -= PageViewElement_ItemSelected; detailCell.PageViewElement.ItemSelected += PageViewElement_ItemSelected; } } private void PageViewElement_ItemSelected(object sender, RadPageViewItemSelectedEventArgs e) { if (e.SelectedItem.Text == "MyEmptyTemplate") { this.SetsGridViewTemplate.AddNewRowPosition = SystemRowPosition.Bottom; } }
To reproduce: use the attached sample project. Follow the steps illustrated on the attached gif file. Workaround: keep the vertical scrollbar value and maximum before modifying the child rows and restore them afterwards: private void gridViewParameter_CellValueChanged(object sender, GridViewCellEventArgs e) { if (e.Column.Name == "Select") { this.gridViewParameter.CellValueChanged -= gridViewParameter_CellValueChanged; GridViewRowInfo selectedRowinfo = e.Row; if (selectedRowinfo.HasChildRows()) { int scrollValue = this.gridViewParameter.TableElement.VScrollBar.Value; int scrollMax = this.gridViewParameter.TableElement.VScrollBar.Maximum; this._UpdateUiState(selectedRowinfo.ChildRows, Convert.ToBoolean(selectedRowinfo.Cells["Select"].Value)); this.gridViewParameter.TableElement.VScrollBar.Maximum = scrollMax; this.gridViewParameter.TableElement.VScrollBar.Value = scrollValue; } this.gridViewParameter.CellValueChanged += gridViewParameter_CellValueChanged; } } NOTE: after applying the workaround, there is annoying flickering illustrated on the Flickering.gif file which should be handled if possible.
To reproduce: 1.Populate RadGridView with data and enable Excel-like filtering. 2.Click on a column filter icon and type in the Search textbox so more than two results appear. Then, click OK 2.The grid returns correct result. 3. Click on the previous column filter icon and navigate to Available Filters -> Contains 4. Evaluate the initial pop up dialog. Its conditions should be "Contains" and "Contains". Actually, it shows "Equals" and "Equals" according to the available filter. Workaround:By using the CreateCompositeFilterDialog event you can replace the default CompositeFilterForm with your custom one where you can load the selected filter operators.
To reproduce: use the following code snippet and have a look at the attached gif file. Steps: 1.Populate RadGridView with data and enable Excel-like filtering. 2.Click on a column filter icon and type in the Search textbox so more than two results appear. Then, click OK 2.The grid returns correct result. 3. Click on the previous column filter icon and navigate to Available Filters -> Contains 4. Evaluate the initial pop up dialog. You will notice that the 3rd filter descriptor is not displayed in the form. 5. Then, click OK 6. A message that says: "The composite filter descriptor is not valid". 7. Change the latter condition to "No filter" and click OK 8. The grid returns correct result. CompositeFilterForm should be improved on a way to display all applied filters,not only two of them. public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Group", typeof(string)); dt.Columns.Add("Description", typeof(string)); for (int i = 0; i < 20; i++) { dt.Rows.Add(GenerateWord(3), "Description"); } this.radGridView1.DataSource = dt; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.EnableFiltering = true; this.radGridView1.ShowHeaderCellButtons = true; this.radGridView1.ShowFilteringRow = false; this.radGridView1.CreateCompositeFilterDialog += radGridView1_CreateCompositeFilterDialog; } string word = null; int cons; int vow; //counter int i = 0; bool isword = false; Random rand = new Random(); //set a new string array of consonants string[] consonant = new string[] { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z" }; //set a new string array of vowels string[] vowel = new string[] { "a", "e", "i", "o", "u" }; string GenerateWord(int length) { if (length < 1) // do not allow words of zero length throw new ArgumentException("Length must be greater than 0"); string word = string.Empty; if (rand.Next() % 2 == 0) // randomly choose a vowel or consonant to start the word word += consonant[rand.Next(0, 20)]; else word += vowel[rand.Next(0, 4)]; for (int i = 1; i < length; i += 2) // the counter starts at 1 to account for the initial letter { // and increments by two since we append two characters per pass string c = consonant[rand.Next(0, 20)]; string v = vowel[rand.Next(0, 4)]; if (c == "q") // append qu if the random consonant is a q word += "qu"; else // otherwise just append a random consant and vowel word += c + v; } // the word may be short a letter because of the way the for loop above is constructed if (word.Length < length) // we'll just append a random consonant if that's the case word += consonant[rand.Next(0, 20)]; return word; } Workaround: By using the CreateCompositeFilterDialog event you can replace the default CompositeFilterForm with your custom one where you can load all available filter descriptors.
To reproduce: radGridView1.TableElement.ColumnScroller.ScrollMode = ItemScrollerScrollModes.Discrete; Workaround: radGridView1.TableElement.HScrollBar.MouseUp += RadGridView1_HScrollBarMouseUp; private void RadGridView1_HScrollBarMouseUp(object sender, MouseEventArgs e) { int ixCol = GetLeftCol(radGridView1); Debug.WriteLine( "Index = "+ ixCol); if (ixCol > -1) { radGridView1.TableElement.ScrollToColumn(ixCol); radGridView1.Rows[0].Cells[ixCol].EnsureVisible(); } } private int currentLeftColumnIndex = 0; private int lastScrollPos = 0; public int GetLeftCol(RadGridView grd) { try { if (!grd.Columns.Any()) return -1; if (!grd.TableElement.VisualRows.Any()) return -1; if (grd.TableElement.ColumnScroller.Scrollbar.Value == 0) return -1; GridRowElement firstVisualRow = grd.TableElement.VisualRows.Where(r => r is Telerik.WinControls.UI.GridDataRowElement).First(); GridCellElement firstVisualCell = firstVisualRow.VisualCells.Where(c => c is Telerik.WinControls.UI.GridDataCellElement).First(); GridCellElement lastVisualCell = firstVisualRow.VisualCells.Where(c => c is Telerik.WinControls.UI.GridDataCellElement).Last(); if (grd.TableElement.ColumnScroller.Scrollbar.Value > lastScrollPos) { //"Scrolling Right" if (lastVisualCell.ColumnIndex == grd.Columns.Last().Index) { lastScrollPos = grd.TableElement.ColumnScroller.Scrollbar.Value; return -1; } if (currentLeftColumnIndex == firstVisualCell.ColumnIndex) { currentLeftColumnIndex += 1; } else { currentLeftColumnIndex = firstVisualCell.ColumnIndex < grd.Columns.Count ? firstVisualCell.ColumnIndex : grd.Columns.Count - 1; } lastScrollPos = grd.TableElement.ColumnScroller.Scrollbar.Value + 1; } else { currentLeftColumnIndex = firstVisualCell.ColumnIndex; lastScrollPos = grd.TableElement.ColumnScroller.Scrollbar.Value - 1; } return currentLeftColumnIndex; } catch (Exception ex) { return -1; } }
To reproduce: public Form1() { InitializeComponent(); this.Text = Telerik.WinControls.VersionNumber.MarketingVersion + " " + Telerik.WinControls.VersionNumber.Number; this.radGridView1.Dock = DockStyle.Fill; string[] coffeeDrinks = { "Americano", "Cafe Crema", "Caffe Latte", "Caffe macchiato", "Coffee milk", "Cafe mocha", "Irish coffee", }; DataTable tableDrinks = new DataTable(); tableDrinks.Columns.Add("DrinkID", typeof(int)); tableDrinks.Columns.Add("Drink", typeof(string)); tableDrinks.Columns.Add("State", typeof(bool)); for (int i = 0; i < coffeeDrinks.Length; i++) { if (i % 2 == 0) { tableDrinks.Rows.Add(i, coffeeDrinks[i], true); } else { tableDrinks.Rows.Add(i, coffeeDrinks[i], false); } } this.radGridView1.DataSource = tableDrinks; GroupDescriptor descriptor = new GroupDescriptor(); descriptor.GroupNames.Add("State", ListSortDirection.Ascending); this.radGridView1.GroupDescriptors.Add(descriptor); this.radGridView1.MasterTemplate.ExpandAllGroups(); this.radGridView1.TableElement.GroupIndent = 1; } When set the GroupIndent property to 1, the space should be 1 pixel. Currently is bigger than 1 pixel (see attached image). And when users wants to hide the indent column, can not set the GroupIndent property to 0. Workaround: this.radGridView1.TableElement.GroupIndent = 1; foreach (GridViewColumn col in this.radGridView1.TableElement.ViewElement.RowLayout.RenderColumns) { if (col is GridViewIndentColumn) { col.MinWidth = 0; break; } }
The idea is that one can bring into view a certain row.
Workaround: check for the theme and set a minimum size to the text box item private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { BaseGridEditor gridEditor = e.ActiveEditor as BaseGridEditor; if (gridEditor != null) { RadTextBoxElement el = gridEditor.OwnerElement.FindDescendant<RadTextBoxElement>(); if (el != null) { if (ThemeResolutionService.ApplicationThemeName == "VisualStudio2012Dark") { el.TextBoxItem.MinSize = new Size(0, 20); el.TextBoxItem.TextBoxControl.MinimumSize = new Size(0, 20); } } } }
To reproduce: 1.Add a grid and populate it with data. 2.Apply a theme to the entire application, e.g. TelerikMetro 3.Activate the grid editor. 4.Change the theme to VisualStudio2012Dark or HigthContrastBlack. 5.Activate the grid editor again. You will notice that editor's back color remains white and you are not able to read the text. Note: if you apply initially VisualStudio2012Dark theme, editor's back color is correct. Please refer to the attached gif file, illustrating this incorrect style. Workaround: private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { BaseGridEditor gridEditor = e.ActiveEditor as BaseGridEditor; if (gridEditor != null) { RadTextBoxElement el = gridEditor.OwnerElement.FindDescendant<RadTextBoxElement>(); if (el != null) { if (ThemeResolutionService.ApplicationThemeName == "VisualStudio2012Dark") { el.BackColor = Color.Black; } } } }