I want to send a value when I press a button in a form to another form through the MVVM pattern.
This is the XAML file
<Button x:Name="myButton"
Text="RandomButton"
TextColor="#000000"
BackgroundColor="{x:Static local:FrontEndConstants.ButtonBackground}"
Grid.Row="2" Grid.Column="0"
Grid.ColumnSpan="3"
Command="{Binding NewPage}"
CommandParameter="100">
</Button>
And this is my ModelView class
where I get redirected to another form.
class JumpMVVM :INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private INavigation _navigation;
public ICommand NewPage
{
get
{
return new Command(async () =>
{
await _navigation.PushAsync(new Page2()); // HERE
});
}
}
public JumpMVVM() { }
public JumpMVVM(INavigation navigation)
{
_navigation = navigation;
}
The jump works. How can I send that "CommandParameter" to "Page2" ?
Thanks, Dragos