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

ListView with switch/checkbox

Is it possible to have only 2 columns with text and switch (ios) / checkbox(droid&wf). Lets say a list of fruits on the left column and the buttons or the right column! like you have here https://help.syncfusion.com/xamarin/sfdatagrid/overview. Are the selection events work with the btns and if yes can I have multiple selections? Thanks

2 Replies

SB Stratis Batikas November 10, 2016 01:28 PM UTC

Something similar to that https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/multiselect/ but using the syncfusion!


DS Divakar Subramaniam Syncfusion Team November 11, 2016 07:29 AM UTC

Hi Stratis, 
 
 
Thanks for contacting Syncfusion Support. 
 
 
In SfDataGrid, it is possible to achieve your requirement. You can enable multiple selection in SfDataGrid by setting SfDataGrid.SelectionMode as “Multiple”. 
 
<syncfusion:SfDataGrid x:Name="dataGrid" 
                       AutoGenerateColumns="False" 
                       ColumnSizer="Star" 
                       ItemsSource="{Binding OrdersInfo}" 
                       SelectionMode="Multiple"> 
 
 
If you need to apply the selection for the column having button, then it is possible by loading button in the center and leave the space to the left and right of the button instead of loading the button to the cell size. Please refer the below code snippet for better understand. 
 
<syncfusion:GridTemplateColumn MappingName="Fruits"> 
    <syncfusion:GridTemplateColumn.CellTemplate> 
        <DataTemplate> 
            <Grid> 
                <Grid.ColumnDefinitions> 
                    <ColumnDefinition Width="*" /> 
                    <ColumnDefinition Width="Auto" /> 
                    <ColumnDefinition Width="*" /> 
                 </Grid.ColumnDefinitions> 
                 <Button Grid.Column="1" Text="{Binding Fruits}" /> 
             </Grid> 
         </DataTemplate> 
     </syncfusion:GridTemplateColumn.CellTemplate> 
</syncfusion:GridTemplateColumn> 
 
 
We have prepared a sample based on your requirement by loaded the buttons in one column and loaded checkbox in one column and you can download the same from the below link. 
 
 
 
 
Regards, 
Divakar. 


Loader.
Up arrow icon