Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Xamarin Forms - ListView enable 'Swipe To Delete' only for specific ViewCells (Not For All cells)

$
0
0

How to enable 'Swipe To Delete' functionality only for specific ViewCells. I mean,

I have a listview with two sections. First section contains Drafted list of items and Second section contains normal lists of items.

I need to enable 'Swipe To Delete' ONLY FOR DRAFT SECTION in it.

My code:

<ListView.ItemTemplate>

                       **<ViewCell.ContextActions >
                             <MenuItem Clicked="OnDelete" CommandParameter="{Binding .}"
                                Text="Delete" IsDestructive="True"/>
                        </ViewCell.ContextActions>**


                        <ViewCell.View>
                             // some list view cell items
                        </ViewCell.View>
                    </ViewCell>
                </DataTemplate>

</ListView.ItemTemplate>

public void OnDelete(object sender, EventArgs e)
{
var mi = ((MenuItem)sender);
DisplayAlert("Delete Context Action", mi.CommandParameter + " delete context action", "OK");
}

Please help me guys. Thank you so much in Advance... smile:


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>