Currently, this behavior is available for RadGridView and the parent row becomes current/selected after expanding. Please refer to the attached gif file for RadGridView and the missing functionality for RadVirtualGrid.
When the control is populated with hierarchy data, the current arrow icon and the expander icon overlap each other. This is observed when you click on a row.
As a workaround, we can increase the size of the indent column to leave enough space for both icons.
this.radVirtualGrid1.TableElement.IndentColumnWidth = 40;
Then we can move the current row arrow icon to the left (or right, depending on your requirement) in the CellFormatting event handler of the control.
private void radVirtualGrid1_CellFormatting(object sender, VirtualGridCellElementEventArgs e)
{
if (e.CellElement is VirtualGridIndentCellElement)
{
var indentCell = e.CellElement as VirtualGridIndentCellElement;
indentCell.ImageLayout = ImageLayout.None;
indentCell.ImageAlignment = ContentAlignment.MiddleLeft;
}
}
RadVirtualGrid.Selection.HasSelection (VirtualGridSelection.HasSelection) or is never false.
RadVirtualGrid grid = new RadVirtualGrid();
var hasSelection1 = grid.Selection.HasSelection;
_grid.Selection.ClearSelection();
var hasSelection2 = grid.Selection.HasSelection;
After initializing the grid, and not loading anything, HasSelection is true, while nothing is selected.
After clearing the selection, HasSelection remains true.
This property is used in your own code as a pretest for some operations. (Like Copy or Cut).
Am I interpreting this property the wrong way?
Repro steps:
Exception:
Message : Object reference not set to an instance of an object.
Type : System.NullReferenceException
Source : Telerik.WinControls.GridView
Stack trace : Telerik.WinControls.UI.RadVirtualGridElement.CopyToClipboard(Int32 startRow, Int32 startColumn, Int32 endRow, Int32 endColumn, VirtualGridViewInfo viewInfo, Boolean selectedOnly, Boolean cut)
Telerik.WinControls.UI.RadVirtualGridElement.CopySelection()
Turien.Windows.Forms.Telerik.VirtualGrid.VirtualGridViewPlus.RadVirtualGridElementPlus.CopySelection()
Turien.Windows.Forms.Telerik.VirtualGrid.VirtualGridViewPlus.VirtualGridInputBehaviorPlus.HandleUnhandledKeys(KeyEventArgs keys)
Telerik.WinControls.UI.VirtualGridInputBehavior.HandleKeyDown(KeyEventArgs args)
Telerik.WinControls.UI.RadVirtualGrid.OnKeyDown(KeyEventArgs e)
System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
System.Windows.Forms.Control.WmKeyChar(Message& m)
System.Windows.Forms.Control.WndProc(Message& m)
System.Windows.Forms.ScrollableControl.WndProc(Message& m)
Telerik.WinControls.RadControl.WndProc(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
System.Windows.Forms.Application.Run(Form mainForm)
Turien.Schade.PremiumCalculator.LookupTableManager.Program.Main()
When copying to from the RadVirtualGrid to the clipboard, the HTML format is not supported.
I was thinking about creating a feature request, but I really think this is a bug, because:
Please, implement the support for HTML.
When I use the Copy method in the RadGridView, the content is copied to the clipboard in multiple formats. Each format can be cancelled. If a format is cancelled it is not even serialized into the DataObject. This way a programmer can replace the copy-routine for that format with his own.
When I do the same with RadVirtualGrid, and I only want to copy format CSV and I want to cancel the rest, nothing is copied to the clipboard. The funny thing is, inspecting the code, the data is always serialized to the DataObject BEFORE the event is fired to find out if that action is needed. This is a performance penalty.
So these two behaviors are inconsistent. It is also inconsistent the the Paste-operations of both grids.
Current code:
public void CopyToClipboard(
int startRow,
int startColumn,
int endRow,
int endColumn,
VirtualGridViewInfo viewInfo,
bool selectedOnly,
bool cut)
{
DataObject dataObject = new DataObject();
string data1 = this.ProcessContent(DataFormats.Text, startRow, startColumn, endRow, endColumn, viewInfo, selectedOnly, cut);
dataObject.SetData(DataFormats.UnicodeText, false, (object) data1);
VirtualGridClipboardEventArgs args1 = new VirtualGridClipboardEventArgs(false, DataFormats.UnicodeText, dataObject, this.CurrentCell.ViewInfo);
this.OnCopying(args1);
if (args1.Cancel)
return;
dataObject.SetData(DataFormats.Text, false, (object) data1);
VirtualGridClipboardEventArgs args2 = new VirtualGridClipboardEventArgs(false, DataFormats.Text, dataObject, this.CurrentCell.ViewInfo);
this.OnCopying(args2);
if (args2.Cancel)
return;
string data2 = this.ProcessContent(DataFormats.CommaSeparatedValue, startRow, startColumn, endRow, endColumn, viewInfo, selectedOnly, cut);
dataObject.SetData(DataFormats.CommaSeparatedValue, false, (object) data2);
VirtualGridClipboardEventArgs args3 = new VirtualGridClipboardEventArgs(false, DataFormats.CommaSeparatedValue, dataObject, this.CurrentCell.ViewInfo);
this.OnCopying(args3);
if (args3.Cancel)
return;
Clipboard.SetDataObject((object) dataObject);
}
public void CopyToClipboard(
int startRow,
int startColumn,
int endRow,
int endColumn,
VirtualGridViewInfo viewInfo,
bool selectedOnly,
bool cut)
{
DataObject dataObject = new DataObject();
VirtualGridClipboardEventArgs eventArgs = new VirtualGridClipboardEventArgs(false, DataFormats.UnicodeText, dataObject, CurrentCell.ViewInfo);
OnCopying(eventArgs);
bool useText = !eventArgs.Cancel;
eventArgs = new VirtualGridClipboardEventArgs(false, DataFormats.UnicodeText, dataObject, CurrentCell.ViewInfo);
OnCopying(eventArgs);
bool useUnicodeText = !eventArgs.Cancel;
if (useText || useUnicodeText)
{
string text = __instance.ProcessContent(DataFormats.Text, startRow, startColumn, endRow, endColumn, viewInfo, cut);
if (useText)
dataObject.SetData(DataFormats.Text, false, text);
if (useUnicodeText)
dataObject.SetData(DataFormats.UnicodeText, false, text);
}
eventArgs = new VirtualGridClipboardEventArgs(false, DataFormats.Text, dataObject, CurrentCell.ViewInfo);
OnCopying(eventArgs);
if (!eventArgs.Cancel)
{
string csv = __instance.ProcessContent(DataFormats.CommaSeparatedValue, startRow, startColumn, endRow, endColumn, viewInfo, selectedOnly, cut);
dataObject.SetData(DataFormats.CommaSeparatedValue, false, csv);
}
if (dataObject.GetFormats().Length > 0)
Clipboard.SetDataObject(dataObject);
}
I have a RadVirtualGrid with hierarchical data. When I change the page, then expand a row, and then hit the tab key I get an ArgumentOutOfRangeException:
Value of '-3838' is not valid for 'Value'. 'Value' must be between 'Minimum' and 'Maximum'.
Parameter name: Value
When you have a RadVirtualGrid with hierarchy and after expanding a row if you right-click a cell in the child grid and select the "Copy" item, it doesn't copy the text of the cell I right-clicked, it copies the text of the first cell.
Please test with the attached sample project.
Hi,
I have a RadVirtualGrid. I add a filter descriptor and then fetch the filtered data from the data store. I then clear the filters and perform a different fetch from the store. However, when I click in the filter value textbox the text from the previous filter operation is still there even though I purposely call radVirtualGrid.FilterDescriptors.Clear() prior to fetching the data from the store.
The filter text doesn't display in the filter row for the column where the filter was entered until I click in the text edit area.
How do I get rid of the text from the previous filter?
thanks,
Mike
Please use the following code snippet and click the filter button for the first column in the virtual grid. You will notice that the default menu is shown:
RadContextMenu menu = new RadContextMenu();
public RadForm1()
{
InitializeComponent();
RadDateTimePicker aDateTimePicker = new RadDateTimePicker();
RadMenuItem theMenuItem = new RadMenuItem();
theMenuItem.MinSize = new Size(200, 30);
RadHostItem theHostItem = new RadHostItem(aDateTimePicker);
theMenuItem.Children.Add(theHostItem);
menu.Items.Add(theMenuItem);
this.radVirtualGrid1.RowCount = 50;
this.radVirtualGrid1.ColumnCount = 5;
this.radVirtualGrid1.CellValueNeeded+=radVirtualGrid1_CellValueNeeded;
this.radVirtualGrid1.AllowFiltering = true;
this.radVirtualGrid1.ContextMenuOpening+=radVirtualGrid1_ContextMenuOpening;
}
private void radVirtualGrid1_ContextMenuOpening(object sender, VirtualGridContextMenuOpeningEventArgs e)
{
int i;
string theMenuItemText;
if (e.RowIndex == -3 && e.ColumnIndex < 1)
{
e.ContextMenu = menu.DropDown;
}
}
private void radVirtualGrid1_CellValueNeeded(object sender, VirtualGridCellValueNeededEventArgs e)
{
e.Value = Guid.NewGuid().ToString();
}
To reproduce:
Set the RowSpacing to 10. Press down until the last cell is selected. The view is not scrolled down.
Hi,
I have a problem with the expansion of the last row.
After Row Expanding and Row Collapsing the last or second last row, the last row is not visible because it seems that there I some kind of lock on the scrollbar : it doesn’t scroll down neither with the mouse wheel nor with the button so it is not possible to move on the last row.
If instead you scroll up and then down the row became visible again.
In the attached example project.
Regards
When you setup a hierarchical RadVirtualGrid and set the UseScrollbarsInHierarchy property to false and use VirtualGridAutoSizeColumnsMode.Fill for the child template, you expect that the column's width is calculated according to the total width of the respective template. Hence, if you shrink or enlarge the grid, the columns will shrink/enlarge respectively. However, if you double click the resize cursor between the column headers you will notice that the best-fit action is performed over the column and its width is adjusted. However, the VirtualGridAutoSizeColumnsMode.Fill setting is not respected and you either can't see all the columns, or you obtain some empty space if the column doesn't need much space.
To reproduce: open the Demo application >> VirtualGrid >> First Look example. Follow the steps illustrated in the attached gif file. You will notice that when you expand a row, the "-" sign is show for a second and then it is returned to "+" although the row is still expanded. Workaround: this.radVirtualGrid1.CellFormatting += radVirtualGrid1_CellFormatting; this.radVirtualGrid1.RowExpanded += radVirtualGrid1_RowExpanded; this.radVirtualGrid1.RowCollapsed += radVirtualGrid1_RowCollapsed; private void radVirtualGrid1_RowCollapsed(object sender, VirtualGridRowExpandedEventArgs e) { if (expandedState.ContainsKey(e.RowIndex)) { expandedState[e.RowIndex] = !expandedState[e.RowIndex]; } this.radVirtualGrid1.TableElement.SynchronizeRow(e.RowIndex, true); } Dictionary<int, bool> expandedState = new Dictionary<int, bool>(); private void radVirtualGrid1_RowExpanded(object sender, VirtualGridRowExpandedEventArgs e) { if (!expandedState.ContainsKey(e.RowIndex)) { expandedState.Add(e.RowIndex, false); } expandedState[e.RowIndex] = !expandedState[e.RowIndex]; this.radVirtualGrid1.TableElement.SynchronizeRow(e.RowIndex, true); } private void radVirtualGrid1_CellFormatting(object sender, Telerik.WinControls.UI.VirtualGridCellElementEventArgs e) { VirtualGridIndentCellElement indentCell = e.CellElement as VirtualGridIndentCellElement; if (indentCell != null) { if (expandedState.ContainsKey(e.CellElement.RowIndex) && expandedState[e.CellElement.RowIndex] == true) { indentCell.ExpanderItem.SignImage = Properties.Resources.chevron_up; } else { indentCell.ExpanderItem.SignImage = Properties.Resources.chevron_down; } } }
To reproduce: if you set the TableElement.RowHeight property, it affects the header row as well, but not all cells. As a result the header row overlaps the new row. Workaround: set the TableElement.HeaderRowHeight as well. this.radVirtualGrid1.TableElement.HeaderRowHeight = 50;
It is difficult to replicate the issue and it is not always reproduced. When using the splitter between columns[1] and columns[2] to resize column[1] I found out that releasing the mouse button doesn't cause the splitter to be released, even when clicking on the grid. It seems to work ok once or twice but once it fails then keeps failing. Workaround: private void radVirtualGrid1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { this.radVirtualGrid1.Cursor = Cursors.Default; } }