question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Controlling the toolkit:popup using MVVM

See original GitHub issue

Recently I found out that when I wanted to display the popup I have to call the popup from code behind file .xaml.cs and call the extension method ShowPopup/ShowPopupAsync. It would be a lot easier for us to call that method from ViewModel instead.

For now I have a work around but introducing the feature on upcoming release would be better than to relay on that workaround. Thanks!

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
samir-dahalcommented, Sep 19, 2022

@VladislavAntonyuk , @samir-dahal can you guys guide me towards any sample code/tutorial for implementing the dialog service for calling/opening the popup from vm?

I hope you already have created a popup. To actually show the popup from vm you have to reference the MainPage from

await App.Current.MainPage.ShowPopupAync(new YourPopup()); You can create a helper as well

2reactions
symbiogenesiscommented, Nov 22, 2022

I think this should be re-opened. Ideally under MVVM, you would want the popup itself to have a ViewModel and be able to return a result in a manner entirely driven by the ViewModel.

But currently the Popup’s Close() method is only available inside of the Popup’s codebehind. There is no ICommand interface that can drive the Close event. And the Popup doesn’t even support Behaviors, so you cannot use the EventToCommandBehavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xamarin Community Toolkit Popup MVVM Binding Issue
Attempting to utilize Xamarin Community Toolkit Popups in Xamarin Forms MVVM pattern project, target platforms IOS & Android.
Read more >
Popup - .NET MAUI Community Toolkit
The Popup view allows developers to build their own custom UI and present it to their users.
Read more >
Xamarin Community Toolkit Popup
In this article​​ The Popup control allows developers to create and display popups within their applications. The Popup can be extended to return ......
Read more >
Pass Data From and To Popups with Xamarin ... - YouTube
Under my video about the Xamarin Community Toolkit popups I got a lot of questions about passing data to or returning data from...
Read more >
NET Community Toolkit 8.0 - MVVM Goodness for .NET MAUI
In this talk we'll introduce you to the .NET Community Toolkit and all the libraries and APIs it includes, and show a live...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found