Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为ListView设置ItemSource在iOS上崩溃,在Android上运行良好_C#_Listview_Xamarin_Xamarin.ios_Xamarin.forms - Fatal编程技术网

C# 为ListView设置ItemSource在iOS上崩溃,在Android上运行良好

C# 为ListView设置ItemSource在iOS上崩溃,在Android上运行良好,c#,listview,xamarin,xamarin.ios,xamarin.forms,C#,Listview,Xamarin,Xamarin.ios,Xamarin.forms,我正在使用Xamarin表单创建一个应用程序,其中主页在主堆栈布局中有一个列表视图。分组在我的列表中启用,并在我的XAML中声明如下: <ListView x:Name="listsListView" IsGroupingEnabled="True" GroupDisplayBinding="{Binding groupName}" HasUnevenRows="True" GroupShortNameBinding="{Binding ShortName}">

我正在使用Xamarin表单创建一个应用程序,其中
主页
在主
堆栈布局
中有一个
列表视图
。分组在我的列表中启用,并在我的XAML中声明如下:

<ListView x:Name="listsListView" IsGroupingEnabled="True" GroupDisplayBinding="{Binding groupName}"  
        HasUnevenRows="True" GroupShortNameBinding="{Binding ShortName}">
  <ListView.GroupHeaderTemplate>
      <DataTemplate>
          <ViewCell>
              <Label Text="{Binding groupName}"/>
          </ViewCell>
      </DataTemplate>
  </ListView.GroupHeaderTemplate>

  <ListView.ItemTemplate>
      <DataTemplate>
          <ViewCell>
              <Label Text="{Binding itemName}"/>
          </ViewCell>
      </DataTemplate>
  </ListView.ItemTemplate>
下面是我对
列表组的实现:

public class ListGroup : List<Item>
{
    public string groupName { get; set; }
    public string ShortName { get; set; }

    public ListGroup(string Name)
    {
        this.groupName = Name;
        ShortName = "";
    }
}

我不太清楚为什么,但当我从XAML中删除
GroupShortNameBinding=“{Binding ShortName}”
行时,它现在可以工作了。我想我一直在遵循一个教程,并将它留在了我的《事故代码》中。

您也可以分享一下您是如何实现
列表组的吗?
?是的,我马上编辑它
public class ListGroup : List<Item>
{
    public string groupName { get; set; }
    public string ShortName { get; set; }

    public ListGroup(string Name)
    {
        this.groupName = Name;
        ShortName = "";
    }
}
Date/Time:       2017-03-23T01:58:34Z
Launch Time:     2017-03-23T01:55:34Z
OS Version:      Mac OS X 10.2 (16D32)
Report Version:  104

Exception Type:  SIGABRT
Exception Codes: #0 at 0x11a944dd6
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithUTF8String:]: NULL cString'

Last Exception Backtrace:
0   CoreFoundation                       0x0000000118af9d33 0x118a03000 + 1010995
1   libobjc.A.dylib                      0x0000000119a4421e 0x119a3f000 + 21022
2   CoreFoundation                       0x0000000118b632b5 0x118a03000 + 1442485
3   Foundation                           0x00000001105a2624 0x11058c000 + 91684
4   MyApp.iOS                         0x000000010dcd29a0 0x10d9f1000 + 3021216
5   MyApp.iOS                         0x000000010dcdc73a 0x10d9f1000 + 3061562
6   MyApp.iOS                         0x000000010dcd568a 0x10d9f1000 + 3032714
7   MyApp.iOS                         0x000000010dcdbdbd 0x10d9f1000 + 3059133
8   MyApp.iOS                         0x000000010dcdd171 0x10d9f1000 + 3064177
9   UIKit                                0x000000010eacff71 0x10e96e000 + 1449841
10  MyApp.iOS                         0x000000010dcdd2f9 0x10d9f1000 + 3064569
11  ???                                  0x00000001321d76ae 0x0 + 0