|
<ContentPage.BindingContext>
<local:ViewModel x:Name="viewModel"/>
</ContentPage.BindingContext>
<sync:SfListView x:Name="listView"
AutoFitMode="DynamicHeight"
AllowSwiping="True"
ItemsSource="{Binding OrderItemCollection}"
SelectionMode="None" BackgroundColor="Accent" >
... |
|
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
var list = App.Database.GetItemsAsync();
viewModel.OrderItemCollection = new System.Collections.ObjectModel.ObservableCollection<OrderItem>(list);
removeButton.Clicked += Button_Clicked;
}
private void Button_Clicked(object sender, EventArgs e)
{
viewModel.database.DropTable<OrderItem>();
viewModel.OrderItemCollection.Clear();
viewModel.database.CreateTable<OrderItem>();
}
} |
|
Query |
Response | |
|
Need to order entries once the switchbutton is clicked |
Sorry for the inconvenience caused. Based on the code snippets provided, we suggest you to use ObservableCollection to reorder the items. We would like to inform you that you can achieve the requirement using Move method of the ObservableCollection.
Please follow the below code snippets for more reference,
| |
|
Need to delete all entries once the button is clicked |
We would like to let you know that you can delete the entries of the SfListView by clearing the ViewModel collection as suggested before.
|
|
Query |
Response | ||
|
How do i keep checkbox checked when it moves on the list? |
You can achieve this requirement by binding the SfCheckBox.IsChecked property. Please find the below code snippets,
Bind the mode property to the SfCheckBox.IsChecked property,
You can also refer to our user guidance document regarding the same from the following link,
| ||
|
how to move back to the start of the list if i uncheck it? |
You can achieve your requirement by changing the ViewModel collection based on IsChecked property.
Please refer the following code snippets,
Code behind:
|