System.NullReferenceException: 'Object reference not set to an instance of an object.' when removing items from the list:
public Form1()
{
InitializeComponent();
for (var i = 0; i < 30; i++)
{
var item = new ListViewDataItem();
radListView2.Items.Insert(0, item);
item[0] = i;
item[1] = i;
item[2] = i;
item[3] = i;
}
}
private void radButton1_Click(object sender, EventArgs e)
{
try
{
radListView2.BeginUpdate();
foreach (var lvi in radListView2.Items.ToArray())
{
radListView2.Items.Remove(lvi);
}
}
finally
{
radListView2.EndUpdate();
}
}
This problem is even reproducible in our Demo application >> Virtual Grid >> Web service example. You will notice that when you scroll to the bottom, the waiting indicator is not being animated when the DPI scaling is higher than 100%.
If you apply the same gif file in a PictureBox it gets animated when using 150% DPI scaling.
Please refer to the attached sample project and follow the steps illustrated in the gif file.
Note: if the vertical scrollbar is visible, the editor is activated as expected.
Workaround:
Me.RadListView1.ItemSize = New Size(200, 30)
Use the attached project and start dragging an item to trigger scrolling. As a result, an error occurs. The attached gif file illustrates the steps.
Workaround:
Me.RadListView1.ListViewElement.DragDropService = New CustomListViewDragDropService(Me.RadListView1.ListViewElement)
Public Class CustomListViewDragDropService
Inherits ListViewDragDropService
Public Sub New(owner As RadListViewElement)
MyBase.New(owner)
End Sub
Protected Overrides Sub OnPreviewDragOver(e As RadDragOverEventArgs)
MyBase.OnPreviewDragOver(e)
End Sub
Protected Overrides Sub HandleMouseMove(mousePos As Point)
If Not Me.Initialized Then
MyBase.HandleMouseMove(mousePos)
End If
Dim mi As MethodInfo = GetType(RadDragDropService).GetMethod("DoDrag", BindingFlags.Instance Or BindingFlags.NonPublic)
mi.Invoke(Me, New Object() {mousePos})
Dim fi2 As FieldInfo = GetType(RadDragDropService).GetField("beginPoint", BindingFlags.Instance Or BindingFlags.NonPublic)
fi2.SetValue(Me, mousePos)
Dim fi As FieldInfo = GetType(ListViewDragDropService).GetField("dragHintWindow", BindingFlags.Instance Or BindingFlags.NonPublic)
Dim dragHintWindow = fi.GetValue(Me)
If dragHintWindow Is Nothing AndAlso Me.CanCommit Then
Me.PrepareDragHint()
End If
Me.UpdateDragHintLocation(mousePos)
Dim viewElement As RadListViewElement = Me.Owner
Dim item As BaseListViewVisualItem = TryCast(Me.DropTarget, BaseListViewVisualItem)
If item IsNot Nothing AndAlso item.Data IsNot Nothing AndAlso Not item.Data.Owner.Equals(viewElement) Then
viewElement = item.Data.Owner
End If
Dim clientPos As Point = viewElement.PointFromScreen(mousePos)
If (clientPos.Y < 0 AndAlso viewElement.ViewElement.Orientation = Orientation.Vertical) OrElse (clientPos.X < 0 AndAlso viewElement.ViewElement.Orientation = Orientation.Horizontal) Then
viewElement.ViewElement.Scroller.Scrollbar.PerformSmallDecrement(1)
ElseIf (clientPos.Y > viewElement.Size.Height AndAlso viewElement.ViewElement.Orientation = Orientation.Vertical) OrElse (clientPos.X > viewElement.Size.Width AndAlso viewElement.ViewElement.Orientation = Orientation.Horizontal) Then
viewElement.ViewElement.Scroller.Scrollbar.PerformSmallIncrement(1)
End If
End Sub
End Class
Just to report a little typo in RadListViewElement:
Protected Overrides Sub OnCurrecntItemChanged(args As ListViewItemEventArgs)
Thanks.