Closed ghost closed 7 years ago
Please provide a description of how exactly you add the command binding
C#
goButton.SetBinding(Button.CommandProperty, new Binding("NavigateToReminder"));
XAML:
<Button Text="Open Reminder page" Command="{Binding NavigateToReminder}"/>
ViewModel command:
public ICommand NavigateToReminder
{
get
{
//code does not get this far as command not firing
return new MvxCommand(async () =>
{
//code does not get this far as command not firing
});
}
}
I've formatted your post. Also there is a MvxAsyncCommand for async operations which you might want to use instead.
Will take a look if I can reproduce your issue.
MasterDetailPage-MvvmCross-master 4.zip
Attached example with code aboved added to the todolistpage & todolistviewmodel.
really appreciate if you can help resolve as this is a blocker for us moving forward.
Your sample uses unsupported and outdated nuget packages. Please update them to non-HotTuna.
Anyways. When navigating to the TodoListPage, and checking the BindingContext in OnAppearing, its BindingContext is MainViewModel and not TodoListViewModel. This is your problem.
Why this is the case, I have no idea. At least you now know what is going on...
Sample is directly from the Xamarin mvvmcross forms git repository.
Hence I think the issue is in the mvvmcross forms demo the team provided with mvvmcross forms.
Do you know who the mvvmcross forms owners is, maybe they can ahead some light on the issue.
Looks like all the detail view models are bound to the mainviewmodel.
Alternatively, how to force binding it to correct one after the fact. From what I recall there is a way to bind a page to multiple viewmodels
What is the link for that sample? I dunno who submitted it, a git blame
could maybe reveal something.
Do you by any chance have another example where masterdetail is used with Xamarin forms version of mvvmcross . I like the examples on this Git location but no master detail example .
That will solve it for us
found the xamarin forms example source: https://github.com/xamarin/xamarin-forms-samples/tree/master/Navigation/MasterDetailPage
Apologies : here is the MVVM Cross forms one :https://github.com/robinmj/MasterDetailPage-MvvmCross
Which is not an official source. You could try ask the author of the sample. I don't think we have a sample showing MasterDetailPage. A PR showing this would be appreciated.
Hi! I'm working on a way to use a MasterDetailPage with MvxForms using a custom Presenter. I think that I could provide a PR with implementation and an example. Do you agree with this?
PRs are welcome.
OK, The PR is live now #60 Please check it to see if everything is fine.
When can PR #60 be merged and pushed to nuget store.
To help us fix your issue, please provide the information in the below template.
Commands should fire like they do with the rest of mvvmcross
Actual behavior
and does not fire
Configuration
Version: 4.x
Platform: iOS/Android/Windows UWP
All platforms . iOS, android and uwp