To reproduce: please refer to the attached sample project and gif file illustrating the behavior. Add cell value in the new row and press teh down arrow. Workaround: this.radGridView1.MasterTemplate.SelectLastAddedRow = false; This problem is applicable for OpenEdge as well: http://knowledgebase.progress.com/articles/Article/Telerik-RadGridView-highlights-unnecessary-columns-and-rows-in-batch-mode
To reproduce:
- Create ColumnGroupsViewDefinition and export it with the following code:
SpreadExportRenderer renderer = new SpreadExportRenderer();
GridViewSpreadExport spreadExporter = new GridViewSpreadExport(radGridView1);
spreadExporter.FreezeHeaderRow = true;
spreadExporter.ExportViewDefinition = true;
spreadExporter.ExportVisualSettings = true;
spreadExporter.ExportGroupedColumns = true;
spreadExporter.ExportHierarchy = true;
spreadExporter.SheetMaxRows = ExcelMaxRows._1048576;
spreadExporter.ExportFormat = SpreadExportFormat.Xlsx;
spreadExporter.FileExportMode = FileExportMode.CreateOrOverrideFile;
spreadExporter.RunExport(dialog.FileName, renderer);
Workaround:
- Set FreezeHeaderRow to false.
You can manually freeze the rows as well:
private void Renderer_WorkbookCreated(object sender, WorkbookCreatedEventArgs e)
{
e.Workbook.ActiveWorksheet.ViewState.FreezePanes(2, 0);
}
To reproduce: please refer to the attached gif file.
Workaround:
public RadForm1()
{
InitializeComponent();
this.radGridView1.CellClick+=radGridView1_CellClick;
}
private void radGridView1_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
if (e.Column is Telerik.WinControls.UI.GridViewRowHeaderColumn)
{
this.radGridView1.CloseEditor();
}
}
To reproduce - Start the attached project press "Add in code" then "Save" - The row is still not added to the underlying data table. Workaround: TryCast(Me.radGridView1.Rows.Last().DataBoundItem, IEditableObject).EndEdit()
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
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();
To reproduce:
- Add a grid to a PageView and add the pageView to a dock window at run time.
- The grid should not be visible.
- Set your DPI setting to 150%
Workaround:
class MyViewDefinition : TableViewDefinition
{
public override IRowView CreateViewUIElement(GridViewInfo viewInfo)
{
return new MyTableElement();
}
}
class MyTableElement : GridTableElement
{
public override void DpiScaleChanged(SizeF scaleFactor)
{
if (this.ViewTemplate != null)
{
base.DpiScaleChanged(scaleFactor);
}
}
protected override Type ThemeEffectiveType
{
get { return typeof(GridTableElement); }
}
}
//use the above definition like this:
radGridView1.ViewDefinition = new MyViewDefinition();
To reproduce: 1. Bind RadGridView to the Northwind.Customers table. 2. Activate the editor for some of the cells from the CustomerID column. 3. Enter "ALFKI" which already exists. The DataError event is supposed to be fired in this case. If you set the GridViewDataErrorEventArgs.ThrowException argument to true the exception is supposed to be thrown. However, nothing happens. Please refer to the attached sample project.
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
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;
}
}
Workaround:
AddHandler Me.RadGridView1.CreateCompositeFilterDialog, AddressOf CreateCompositeFilterDialog
Private Sub CreateCompositeFilterDialog(sender As Object, e As GridViewCreateCompositeFilterDialogEventArgs)
Dim dialog As New CompositeDataFilterForm()
AddHandler dialog.DataFilter.EditorRequired, AddressOf EditorRequired
e.Dialog = dialog
End Sub
Private Sub EditorRequired(sender As Object, e As TreeNodeEditorRequiredEventArgs)
Dim filterNode As DataFilterCriteriaNode = TryCast(e.Node, DataFilterCriteriaNode)
If filterNode IsNot Nothing AndAlso filterNode.PropertyName = "BASE_NULL_DATE" AndAlso TypeOf sender Is DataFilterValueEditorElement Then
e.Editor = New TreeViewDateTimeEditor()
End If
End Sub
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:
- Add DateTime columns to the grid and set the MaskType of the editor to FreeFormDateTime.
- Go to the new row enter a valid date and press Tab.
Workaround:
class Myditor : RadDateTimeEditor
{
public override bool IsModified
{
get
{
return true;
}
}
}
To reproduce:
this.Controls.Add(this.radGridView1);
this.radScheduler1.Dock = DockStyle.Fill;
List<GridRec> records = new List<GridRec>();
GridRec rec = new GridRec();
rec.Column1 = "1";
rec.Column2 = "2";
rec.Column3 = "3";
rec.Column4 = "4";
rec.Column5 = "5";
rec.Column6 = "6";
rec.Column7 = "7";
rec.Column8 = "8";
rec.Column9 = "9";
for (int i = 0; i < 20; ++i)
{
records.Add(rec.Clone());
}
radGridView1.DataSource = records;
this.radGridView1.MultiSelect = true;
this.radGridView1.SelectionMode = GridViewSelectionMode.CellSelect;
this.radGridView1.Dock = DockStyle.Fill;
public class GridRec
{
public GridRec Clone()
{
return this.MemberwiseClone() as GridRec;
}
public string Column1 { get; set; }
public string Column2 { get; set; }
public string Column3 { get; set; }
public string Column4 { get; set; }
public string Column5 { get; set; }
public string Column6 { get; set; }
public string Column7 { get; set; }
public string Column8 { get; set; }
public string Column9 { get; set; }
}
If you run the application, it starts with the upper-left most cell selected. Now, while holding down the Shift key, left-click on the cell in the 5th column of the 5th row (cell 5:5). Note all 25 cells are selected as expected. Now, while still holding Shift, left-click again on cell 5:5 and note the selection is cleared.
Now, while still holding Shift, click on cell 4:4 (4th column, 4th row). Note how the selected range is now cells 1:1 through 4:4. And while still holding Shift, if you click on 4:4 yet again, the selection is cleared.
Workaround:
private void radGridView1_SelectionChanging(object sender, Telerik.WinControls.UI.GridViewSelectionCancelEventArgs e)
{
if (e.ColumnStartIndex == e.ColumnEndIndex && Control.ModifierKeys == Keys.Shift)
{
e.Cancel = true;
}
}
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();
}