Forum Xamarin Xamarin.Forms

How i can execute a command from ViewModel?

FersoftInformticaFersoftInformtica ESMember ✭✭
edited February 2016 in Xamarin.Forms

Hello! I have the next portion of XAML:

< StackLayout BindingContext="{StaticResource viewModel}">
< ListView ItemsSource="{Binding Data}" RowHeight="75">
< ListView.ItemTemplate>
< DataTemplate>
< ViewCell>
< ViewCell.ContextActions>
< MenuItem
Text="Activar" />
< /ViewCell.ContextActions>

I don't want to use the Clicked event in the view, I want to use commands. My problem is that I don't know how to access to "viewModel". The binding context of MenuItem is "Data". Is it possible?
If it's not possible, what can i do? I'm thinking in MessagingCenter but... works it in XAML?


Sign In or Register to comment.