Material.Avalonia icon indicating copy to clipboard operation
Material.Avalonia copied to clipboard

Is it possible to use Material.Avalonia.Dialogs on platforms that use Single View Application Lifetime (eg. mobile) ?

Open buzzware opened this issue 1 year ago • 5 comments

DialogDemoViewModel.cs calls dialog.ShowDialog which requires a Window, but it seems impossible to get a Window unless Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime so I don't see how to use dialogs on mobile.

Material.Avalonia is actually currently the best path to building mobile apps with Avalonia at present, so this issue is particularly frustrating.

buzzware avatar Aug 09 '24 07:08 buzzware

Hello, probably there is an option with DialogHost, but I don't know how dialogs are implemented, so I've also try to take a look at the weekend. If you can manage it by yourself - let me know.

SKProCH avatar Aug 09 '24 15:08 SKProCH

I've look at code, and seems like - currently no way to reuse it for non-windowed dialogs (without faking the window in some way).

Seems like material dialogs should be rewritten to support it, and currently i've doesn't have a time for it. Also, the author of dialogs - @appleneko2001 currently unavailable up to next year. I don't think what i can find time to rewire dialogs by myself before next year (since i still need to find time to develop other features of Material). So, probably you shouldn't expect to me or @appleneko2001 will do something with dialogs before next year, sorry.

It you want you can try to do something by yourself - i'll review that.

SKProCH avatar Aug 21 '24 15:08 SKProCH

DialogDemoViewModel.cs calls dialog.ShowDialog which requires a Window, but it seems impossible to get a Window unless Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime so I don't see how to use dialogs on mobile.

Material.Avalonia is actually currently the best path to building mobile apps with Avalonia at present, so this issue is particularly frustrating.

Actually hit to the point, the old dialog system I made is a prototype, and the APIs are also not a good practice to use in production builds. I can't do anything before this year ends (I can't tell where I am sorry it's quite sensitive)

appleneko2001 avatar Oct 10 '24 13:10 appleneko2001

Recently I'm trying some workaround for solving show dialog results, and I researched that using await foreach a IAsyncEnumerable or foreach with IEnumerable to get one or more results until they returns yield break or reach to the end of the enumerable function (just like how the dialog demo works like) and they are actually pretty well to implement them than weird "event" workaround.

Also I'm thinking to make some DialogElement in DialogViewModel to make them more flexible to build dialog without making a lot variant of Dialog like CustomDialog, DatePickerDialog, TextFieldDialog, and TimePickerDialog, only one DialogWindow will be one for all. This would be how the new Dialog system looks like I guess. Any more ideas?

appleneko2001 avatar May 01 '25 19:05 appleneko2001

I'm working on DialogBuilder API, I have some scratch works already but still not ready, later gonna re-submit PR since first attempt quite broken thanks to git state But it will allows you to use builded control at anywhere, not only standalone window

appleneko2001 avatar May 17 '25 20:05 appleneko2001