To reproduce: please refer to the attached sample project and follow the steps in the provided gif file:
1. Enter something in the search bar
2. Filter on some column, uncheck "All", then select a few items, then validate
3. Click on a random row on the grid
4. Filter on the same column as in 2., check "All", then uncheck a few items, then validate
Workaround:
private void radGridView1_FilterChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e)
{
this.radGridView1.MasterTemplate.Refresh();
}
To reproduce: this.radGridView1.MultiSelect = true; this.radGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect; radGridView1.ShowRowHeaderColumn = false; Then select the cells in the firs column by dragging the mouse. Workaround: // radGridView1.ShowRowHeaderColumn = false; radGridView1.TableElement.RowHeaderColumnWidth = 0;
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");
}
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.
To reproduce: please open the attached sample project and follow the steps illustrated in the attached gif file.
Workaround:
1. You still can scroll while dragging a row by using the mouse wheel.
2. Use the grid in unbound mode and set the AllowRowReorder property to true instead of using a custom RadDragDropService.
3. Use a custom drag and drop service:
public class CustomDragDropService : RadGridViewDragDropService
{
public CustomDragDropService(RadGridViewElement gridViewElement) : base(gridViewElement)
{
}
public override string Name
{
get
{
return typeof(RadGridViewDragDropService).Name;
}
}
protected override void HandleMouseMove(System.Drawing.Point mousePosition)
{
base.HandleMouseMove(mousePosition);
System.Drawing.Point location = this.GridViewElement.ElementTree.Control.PointToClient(Control.MousePosition);
GridTableElement tableElement = this.GetTableElementAtPoint(location);
ISupportDrag supportDrag = this.Context as ISupportDrag;
object dataContext = supportDrag.GetDataContext();
if (this.AllowAutoScrollRowsWhileDragging && dataContext == null)
{
ScrollRows(tableElement, location);
}
}
private void ScrollRows(GridTableElement tableElement, System.Drawing.Point location)
{
ScrollableRowsContainerElement scrollableRows = tableElement.ViewElement.ScrollableRows;
RadScrollBarElement vScrollbar = GetVeritcalScrollbar(tableElement);
System.Drawing.Rectangle containerBounds = scrollableRows.ControlBoundingRectangle;
if (containerBounds.Contains(location) ||
location.X < containerBounds.X ||
location.X > containerBounds.Right)
{
return;
}
int delta = 0;
if (location.Y > containerBounds.Bottom)
{
delta = location.Y - containerBounds.Bottom;
}
else if (location.Y < containerBounds.Y)
{
delta = location.Y - containerBounds.Y;
}
if (delta != 0 && vScrollbar.Visibility == ElementVisibility.Visible)
{
vScrollbar.Value = ClampValue(vScrollbar.Value + delta,
vScrollbar.Minimum,
vScrollbar.Maximum - vScrollbar.LargeChange + 1);
}
}
private int ClampValue(int value, int minimum, int maximum)
{
if (value < minimum)
{
return minimum;
}
if (maximum > 0 && value > maximum)
{
return maximum;
}
return value;
}
private RadScrollBarElement GetVeritcalScrollbar(GridTableElement tableElement)
{
if (GridViewElement.UseScrollbarsInHierarchy)
{
return tableElement.VScrollBar;
}
return GridViewElement.TableElement.VScrollBar;
}
}
public RadForm1()
{
InitializeComponent();
CustomDragDropService customService = new CustomDragDropService(radGridView1.GridViewElement);
radGridView1.GridViewElement.RegisterService(customService);
}
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();
}
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;
}
}
How to reproduce: check the attached video
Workaround: disable pinning of the last row when it is in a group
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.ContextMenuOpening += RadGridView1_ContextMenuOpening;
}
private void RadGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
{
GridRowHeaderCellElement header = e.ContextMenuProvider as GridRowHeaderCellElement;
if (header != null && header.RowInfo.Group != null)
{
var notPinned = header.RowInfo.Group.GroupRow.ChildRows.Where(r => r.IsPinned == false).ToList();
if (notPinned.Count <= 1)
{
e.ContextMenu.Items.RemoveAt(0);
e.ContextMenu.Items.RemoveAt(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 < 2; i++)
{
for (int j = 0; j < 2; j++)
{
dt.Rows.Add(i, "Name " + i + " " + j, DateTime.Now.AddDays(i), i % 2 == 0);
}
}
return dt;
}
}
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;
}
Workaround:
Friend Class MyRadGridView
Inherits RadGridView
Public Overrides Property ThemeClassName As String
Get
Return GetType(RadGridView).FullName
End Get
Set(value As String)
MyBase.ThemeClassName = value
End Set
End Property
Protected Overrides Function CreateGridViewElement() As RadGridViewElement
Return New MyRadGridViewElement()
End Function
End Class
Friend Class MyRadGridViewElement
Inherits RadGridViewElement
Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
Get
Return GetType(RadGridViewElement)
End Get
End Property
Protected Overrides Function CreateGroupPanelElement() As GroupPanelElement
Return New MyGroupPanelElement()
End Function
End Class
Friend Class MyGroupPanelElement
Inherits GroupPanelElement
Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
Get
Return GetType(GroupPanelElement)
End Get
End Property
Protected Overrides Function ArrangeOverride(finalSize As SizeF) As SizeF
Dim clientRect As RectangleF = Me.GetClientRectangle(finalSize)
Dim sizeGripRect As New RectangleF(clientRect.X, clientRect.Bottom - Me.SizeGrip.DesiredSize.Height, clientRect.Width, Me.SizeGrip.DesiredSize.Height)
Me.SizeGrip.Arrange(sizeGripRect)
clientRect.Height -= Me.SizeGrip.DesiredSize.Height
Dim groupHeaderRect As New RectangleF(clientRect.X, clientRect.Y, Me.Header.DesiredSize.Width, clientRect.Height)
Me.Header.Arrange(groupHeaderRect)
clientRect.Width -= Me.Header.DesiredSize.Width
Dim scrollViewRect As New RectangleF(clientRect.X + Me.Header.DesiredSize.Width, clientRect.Y, clientRect.Width, clientRect.Height)
If scrollViewRect.Width > 20 Then
Me.ScrollView.Arrange(scrollViewRect)
End If
Return finalSize
End Function
End Class
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);
}
How to reproduce check the attached project:
Workaround: Create a custom spread export renderer
public class MySpreadExportRenderer : SpreadExportRenderer
{
public override void AddWorksheet(string sheetName)
{
string name = "";
Workbook wb = (Workbook)typeof(SpreadExportRenderer).GetField("workbook", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this);
if (sheetName == null || sheetName == string.Empty)
{
name = "Sheet_" + (wb.Worksheets.Count + 1);
}
else
{
name = sheetName;
}
if (wb.Worksheets.Where(w => w.Name == name).ToList().Count == 0)
{
base.AddWorksheet(sheetName);
}
else
{
typeof(SpreadExportRenderer).GetField("worksheet", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, wb.Worksheets.Add());
}
}
}
Please refer to the attached sample project and follow the steps illustrated in the attached gif file.
Attached project for reproducing. Workaround: var column = radGridView1.Columns[2] as GridViewDecimalColumn; var format = column.FormatString; column.FormatString = ""; column.ExcelExportType = DisplayFormatType.Currency; //export the grid column.FormatString = format;
To reproduce: please refer to the attached sample project. Click the button several times to add 3-4000 rows and toggle the checkbox. You will notice that every time you add new rows and hide the column it takes a long time. The more rows you have, the more time it requires.
Workaround:
radGridView1.MasterTemplate.BeginUpdate();
radGridView1.Columns[0].IsVisible = checkBox1.Checked;
radGridView1.MasterTemplate.EndUpdate();
Workaround: Use the Copying event.
To reproduce: Please refer to the attached gif file and follow the steps
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("ParentId", typeof(int));
dt.Columns.Add("Date", typeof(DateTime));
Random rand = new Random();
for (int i = 0; i < 5; i++)
{
dt.Rows.Add(i, -1, DateTime.Now);
}
for (int j = 5; j < 10; j++)
{
dt.Rows.Add(j, rand.Next(0, 5), DateTime.Now.AddDays(j));
}
this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "Id", "ParentId");
this.radGridView1.DataSource = dt;
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
GridViewDateTimeColumn dateTimeColumn = this.radGridView1.Columns.Last() as GridViewDateTimeColumn;
dateTimeColumn.FilteringMode = GridViewTimeFilteringMode.Date;
this.radGridView1.EnableFiltering = true;
Workaround: use the standard hierarchy: http://docs.telerik.com/devtools/winforms/gridview/hierarchical-grid/binding-to-hierarchical-data-programmatically
OR the custom filtering: http://docs.telerik.com/devtools/winforms/gridview/filtering/custom-filtering