-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command bindings are not re-established when navigating back and forth in UIInterface samples #484
Comments
I don't think I fully understand the problem, but looking at the solution I highly doubt that this is something we should want to be honest. Doesn't really seem to be a great practice. Refreshing the whole Could you maybe elaborate a bit more on what the problem is that you're seeing? Also is this happening on one platform or all the platforms? |
@jfversluis Navigation only works once. This sample for example, once you click on any of the navigable items in the Using the latest VS, download your sample as a .zip file and this should be easily reproducible. Fwiw, clicking the first item in the |
For some reason I haven't got the notifications for this thread, but the issue is exactly what @gcadmes-extron wrote above. If refreshing the Current version: NavigateCommand = new Command<Type>(
async (Type pageType) =>
{
Page page = (Page)Activator.CreateInstance(pageType);
await Navigation.PushAsync(page);
}); |
This comment was marked as off-topic.
This comment was marked as off-topic.
This is only a Windows problem? |
@davidbritch And this issue has been reported multiple times in MAUI repo since long time ago, like dotnet/maui#21112, and #474. My personal workaround is to use OnTapped event handler instead of binding Command to run the sample apps properly. |
Due to how the navigation stack is being managed the command bindings are not properly refreshed when navigating between views in UserInterface samples.
Expected Behavior
Navigation is possible between different Views without reloading the application.
Possible Solution
I've tried an approach where i reset the 'BindingContext' in the 'OnAppearing' method and it solves the problem.
Steps to Reproduce
Possible Implementation
Adding this to the MainPage solves the problem.
The text was updated successfully, but these errors were encountered: