SpanCount in UWP

I configured the SpanCount on ListView, when I execute the App, the below error is shown.

An exception of type 'System.InvalidOperationException' occurred in Syncfusion.SfListView.XForms.dll but was not handled in user code
Additional information: SpanCount cannot be set less than 1.


The XAML code:

<syncfusion:SfListView.Padding>
                <OnIdiom x:TypeArguments="Thickness" Phone="5,0,5,0" Tablet="10,0,10,0" />
            </syncfusion:SfListView.Padding>
            <syncfusion:SfListView.ItemSize>
                <OnPlatform x:TypeArguments="x:Double" iOS="150" Android="250" />
            </syncfusion:SfListView.ItemSize>
            <syncfusion:SfListView.LayoutManager>
                <syncfusion:GridLayout SpanCount="1">
                    <syncfusion:GridLayout.SpanCount>
                        <OnPlatform x:TypeArguments="x:Int32">
                            <OnPlatform.WinPhone>
                                <OnIdiom x:TypeArguments="x:Int32" Phone="1" Tablet="3" />
                            </OnPlatform.WinPhone>
                            <OnPlatform.Android>
                                <OnIdiom x:TypeArguments="x:Int32" Phone="1" Tablet="3" />
                            </OnPlatform.Android>
                            <OnPlatform.iOS>
                                <OnIdiom x:TypeArguments="x:Int32" Phone="1" Tablet="3" />
                            </OnPlatform.iOS>
                        </OnPlatform>
                    </syncfusion:GridLayout.SpanCount>
                </syncfusion:GridLayout>
            </syncfusion:SfListView.LayoutManager>

1 Reply

MK Muthu Kumaran Gnanavinayagam Syncfusion Team October 23, 2017 05:15 AM UTC

Hi Jhonatan, 
 
We have checked with the reported query “System.InvalidOperationException throws in GridLayout” from our side. We would like to let you know that Xamarin added ‘Desktop’ as its own idiom from Xamarin.Forms (v 2.3.4.247). As you have not specified the SpanCount value for Desktop the reported exception has been thrown. You can overcome the issue by specifying the SpanCount value as like the below code example. 
 
Code Example[XAML]: 
<listView:SfListView.LayoutManager> 
  <listView:GridLayout SpanCount="1"> 
    <listView:GridLayout.SpanCount> 
      <OnPlatform x:TypeArguments="x:Int32"> 
        <OnPlatform.WinPhone> 
          <OnIdiom x:TypeArguments="x:Int32" Phone="1" Tablet="3" Desktop="6" /> 
        </OnPlatform.WinPhone> 
        <OnPlatform.Android> 
          <OnIdiom x:TypeArguments="x:Int32" Phone="1" Tablet="3" /> 
        </OnPlatform.Android> 
        <OnPlatform.iOS> 
          <OnIdiom x:TypeArguments="x:Int32" Phone="1" Tablet="3" /> 
        </OnPlatform.iOS> 
      </OnPlatform> 
    </listView:GridLayout.SpanCount> 
  </listView:GridLayout> 
</listView:SfListView.LayoutManager> 
 
Please let us know if you require further assistance. 
 
Regards, 
G.Muthu Kumaran.

Loader.
Up arrow icon