-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Native MessageBox API #670
Comments
I think we should take inspiration from UWP and implement MessageDialog and ContentDialog |
+1 for @nc4rrillo |
will require #624 to also be completed. |
I know it's a workaround but what about this: https://habr.com/en/post/454386/ |
Hi @danwalmsley , I see that #624 was closed... Is this workable now? Thanks, Kevin |
Definitely possible now |
Given that this issue is about native message boxes, I've done a bit of research into the various native message box APIs in the platforms we support: Native Message BoxesWin32MessageBox
This is the API used by WPF's TaskDialog
There is a proposal to add an API for this to WinForms: dotnet/winforms#146 TaskDialogIndirect
OSX
X11On X11 message boxes are provided by the toolkit so we would have to implement our own managed message boxes, but for context here's what GTK and QT's message box APIs provide. GTK
QT
Two APIs for using QMessageBox are provided, the property-based API, and the static functions. Calling one of the static functions is the simpler approach, but it is less flexible than using the property-based API, and the result is less informative. Using the property-based API is recommended. Android
iOS
|
If we were to implement a native MessageBox API, I can see 3 choices:
Other things to note:
|
Note that we need some kind of localized text database anyway since we have default context menus textboxes. |
Discussion about a new |
In terms of UI thread lock, I just worked around this issue in WPF with this simple function. Can now run sync UI methods in a fully asynchronous way and await!
|
In the Avalonia port of MvvmDialogs, I need to have a common MessageBox API to share between WPF, Avalonia, UWP, WinUI3, Blazor or anything else (because the ViewModel shouldn't need to know which UI it's running on) What we first need is a basic MessageBox with standard features which should be simple enough to implement. Later on, you could add an ExtendedMessageBox in Avalonia with extra features, which will take more time and it will be harder to come with a stable cross-platform API for. ExtendedMessageBox extension could later be added to MvvmDialogs with support for WPF/Ookii, and for Avalonia if that's added. But it's really difficult for these extended feature settings to be platform-agnostic. My vote is that extended features do not need to be part of the core library but can be added through a separate project, but basic MessageBox features DO need to be part of the core library. Here are the platform-agnostic settings implemented in MvvmDialogs. Is there some issue in natively supporting those settings on all platforms? These basic settings cover 90% of use-cases. |
NEED this |
@Anequit, while we wait for integration of this feature, have you checked out MessageBox.Avalonia? |
Yes I have, but I'm not a huge fan of it personally. I think for the time being I'll opt for an alert popup instead of a message box |
I've just gave it a spin, and it's not resizing vertically for a long texts: It also has no API docs for Would be happy to see out-of-the-box platform-agnostic solution in Avalonia. |
Yes it has a lot of unpolished rough edges. It had no option for setting a default button; they added it but the implementation is badly designed and looks more like a hack. |
I'm having a nice laugh finding out a few hours into coding that I basically have to write my own custom message box to give the user feedback. Incredible. |
As an option, with Prism.Avalonia you make use of the DialogService which provides the ability to make it modal and non-modal with ease. It's pretty much 60 seconds of copy/paste as per the end-to-end sample |
or using MvvmDialogs for Avalonia |
It would be great to have a native Message box API. Win32 on Windows and GTK on Linux / OSX (or Cocoa). Because Cocoa would need to probably be used on iOS anyway, it makes sense for OSX.
The text was updated successfully, but these errors were encountered: