当我滑动以删除ListView项,然后选择另一个项时,系统崩溃

时间:2019-07-02 15:08:05

标签: listview xamarin.forms visual-studio-2019

在我滑动以删除或将任何菜单项添加到列表视图项,然后选择其他项时遇到异常。

更改了一些属性,以查看是否可以缩小范围,但似乎无济于事。看到有一堆人遇到HasUnevenRows有问题,但是更改值不会改变行为。

我为列表视图项创建代码视图,并在允许的情况下传入事件处理程序以供删除:

if (!(EventHandlerItemDelete == null))
{
    var deleteAction = new Xamarin.Forms.MenuItem
    {
        Text = "Delete",
        IsDestructive = true,
    };

    deleteAction.SetBinding(Xamarin.Forms.MenuItem.CommandParameterProperty, new Binding("."));
    deleteAction.Clicked += EventHandlerItemDelete;

    ContextActions.Add(deleteAction);
}

this.View = LayoutCell;

预期结果不会崩溃:这是外部异常:

  

Outer.Message:对象引用未设置为对象的实例   外部来源:Xamarin.Forms.Platform.iOS   Outer.StackTrace:位于Xamarin.Forms.Platform.iOS.ContextScrollViewDelegate + <> c__DisplayClass25_0.b__1(UIKit.UIGestureRecognizer识别器,UIKit.UIGestureRecognizer r)[0x00000]在D:\ a \ 1 \ s \ Xamarin.Forms.Platform.iOS中\ ContextScrollViewDelegate.cs:178     在UIKit.UIGestureRecognizer + _UIGestureRecognizerDelegate处。 g.cs:908     在(包装器托管到本地)UIKit.UIApplication.UIApplicationMain(int,string [],intptr,intptr)     在/Library/Frameworks/Xamarin.iOS.framework/Versions/12.10.0.157/src/Xamarin.iOS中的UIKit.UIApplication.Main(System.String [] args,System.IntPtr主体,System.IntPtr委托)[0x00005] /UIKit/UIApplication.cs:86     在/Library/Frameworks/Xamarin.iOS.framework/Versions/12.10.0.157/src/Xamarin.iOS中的UIKit.UIApplication.Main(System.String [] args,System.StringPrincipalClassName,System.String委托ClassName)[0x0000e] /UIKit/UIApplication.cs:65     在C:\ Development \ GLH \ Administration \ XamAppGrandLife \ XamAppGrandLife.iOS \ Main.cs:15中的XamAppGrandLife.iOS.Application.Main(System.String [] args)[0x00002]   外部数据:System.Collections.ListDictionaryInternal

0 个答案:

没有答案