Forum Xamarin.Forms

How to delete a row in ListView using MVVM pattern

I have a ListView per the xaml code below:

    <ListView ItemsSource ="{Binding Tags}" SelectedItem="{Binding SelectedTag, Mode=TwoWay}">
                    <StackLayout BackgroundColor="#eee" Orientation="Vertical">
                      <StackLayout Orientation="Horizontal">
                        <Entry Text="{Binding Item, Mode=TwoWay}" TextColor="#000000"  HorizontalOptions="Start" WidthRequest ="150" />
                        <Button Text="Remove" Command="{Binding RemoveCommand}" HorizontalOptions="End" WidthRequest ="150"/>

There is a ViewModel behind this xaml page and I have used Prism to wire up the things. When I tap on 'Remove' button, RemoveCommand is not invoked at all nor SelectedTag's property is called too. My goal is when the user taps on 'Remove' button, he/she should be able to remove the respective row from the ListView. What am I doing wrong?


Sign In or Register to comment.