We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set number of columns in SfListView in SfPopup from xaml

Is it possible to set the number of columns of an SfListView contained within a SfPopup in XAML?  If so how would I do that?

John

5 Replies

SK Shivagurunathan Kamalakannan Syncfusion Team September 9, 2019 01:38 PM UTC

Hi John,   
    
Thanks for contacting Syncfusion support.   
 
Your requirement to have multiple columns in SfListview in Xaml page can be achieved by using layout manager in SfListView. You can use GridLayout so that you can load the items based on the columns. 
 
Refer the following code snippet: 
 
<syncfusion:SfListView x:Name="listView"  
                       ItemSize="50"  
                       ItemsSource="{Binding Items}" > 
 
    <syncfusion:SfListView.LayoutManager> 
        <syncfusion:GridLayout SpanCount="3"/> 
    </syncfusion:SfListView.LayoutManager> 
 
 
 
</syncfusion:SfListView> 
 
 
We have prepared a sample in which SfListView has been loaded inside the SfPopupLayout. And it can be downloaded from the below link. 
 
Please let us  know for further assistance. 
    
Regards,   
Shivagurunathan 



JO John September 9, 2019 02:04 PM UTC

Thank you very much!  How would one use OnIdiom to set different spans based on device?

John


SK Shivagurunathan Kamalakannan Syncfusion Team September 10, 2019 10:53 AM UTC

Hi John,   
   
Thanks for the update.     
   
You could set OnIdiom for the SpanCount property of GridLayout. With OnIdiom you can give the values based on the type of device.   
   
Please refer the below user guideline.   
   
Xaml code snippet:   
   
<syncfusion:SfListView.LayoutManager>   
    <syncfusion:GridLayout>   
        <syncfusion:GridLayout.SpanCount>   
            <OnPlatform x:TypeArguments="x:Int32">   
                <On Platform ="UWP">   
                    <OnIdiom x:TypeArguments="x:Int32"    
                             Phone="2"    
                             Tablet="4"    
                             Desktop="4"/>   
                </On>   
                   
                <On Platform ="Android">   
                    <OnIdiom x:TypeArguments="x:Int32"    
                             Phone="2"    
                             Tablet="4" />   
                </On>   
                   
                <On Platform ="iOS">   
                    <OnIdiom x:TypeArguments="x:Int32"    
                             Phone="2"    
                             Tablet="4" />   
                </On>   
            </OnPlatform>   
        </syncfusion:GridLayout.SpanCount>   
    </syncfusion:GridLayout>   
</syncfusion:SfListView.LayoutManager>   
   
  
   
Please refer the attached sample for more details.   
   
Regards,   
Shivagurunathan   



JO John September 10, 2019 12:45 PM UTC

Thank you it works perfect


FP Farjana Parveen Ayubb Syncfusion Team September 11, 2019 05:37 AM UTC

Hi John, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Farjana Parveen A 


Loader.
Live Chat Icon For mobile
Up arrow icon