Skip to content
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

Port the .NET 5 winforms TaskDialog API to WPF #2902

Open
mveril opened this issue Apr 19, 2020 · 14 comments
Open

Port the .NET 5 winforms TaskDialog API to WPF #2902

mveril opened this issue Apr 19, 2020 · 14 comments
Labels
API suggestion Early API idea and discussion, it is NOT ready for implementation
Milestone

Comments

@mveril
Copy link

mveril commented Apr 19, 2020

Hi
I use Task Dialog in several WPF projects. I first used the WindowsAPICodePack library then Ookii.Dialogs. But I would have liked an official implementation. This implementation is now available in Windows Forms dotnet/winforms@5fbdbde thank to @kpreisser that create the following issue dotnet/winforms#146. Would it be possible to port this implementation to WPF ?
Thank you

@mveril mveril changed the title Port the .net 5 winforms TaskDialog API to WPF Port the .NET 5 winforms TaskDialog API to WPF Apr 19, 2020
@batzen
Copy link
Contributor

batzen commented Apr 19, 2020

I am wondering what should be ported exactly? Would just using the dialog from windows forms have any disadvantages?

@mveril
Copy link
Author

mveril commented Apr 19, 2020

I am wondering what should be ported exactly? Would just using the dialog from windows forms have any disadvantages?

The idea is the same as #438. I find it unfortunate to have to use the Windows Forms UI framework only for one or two dialog boxes.

@glyad
Copy link

glyad commented Apr 19, 2020

I am wondering what should be ported exactly? Would just using the dialog from windows forms have any disadvantages?

  1. I can't find any reason for to make my app depending on Win32 or WinForms libraries. I work with MS technologies about 30 years and know that MS can shutdown a framework within a week or after 20 years without any relation to how this framework is usable in the industry.

  2. The idea (philosophy) of WPF is to have UI Control as "lookless". It means there is no look-n-feel code is in control's class. All of the things related to visual appearance of the control are separated as XAML resources and may be redefined. For certain cases, where is no way to ensure control's functionality, it's possible to obtain references to visuals (PART_[s]) and that's all. The Win32 dialog isn't customisable.

  3. The strange of XAML based frameworks, which allows us to build fully customised UI, becomes broken with old-fashioned common dialogs.

  4. The answers of MS managers show that MS want to make WPF unportable forever. Sad!

@weltkante
Copy link

Here's how the same proposal is "done right" for WinUI: add a TaskDialog control in the spirit of WPF instead of exposing the WinForms version in a WPF/WinUI API. WinForms is the wrapper framework for Win32, WPF/WinUI should be doing skinnable versions and not just re-expose what WinForms already does.

@glyad
Copy link

glyad commented Apr 20, 2020

Here's how the same proposal is "done right" for WinUI: add a TaskDialog control in the spirit of WPF instead of exposing the WinForms version in a WPF/WinUI API. WinForms is the wrapper framework for Win32, WPF/WinUI should be doing skinnable versions and not just re-expose what WinForms already does.

Thank you a lot! You're right, it must be defined in the way pointed. Who is the HERO? :)

@miloush
Copy link
Contributor

miloush commented May 6, 2020

I disagree. A system dialog should look and behave consistent with the system.

@weltkante
Copy link

I agree that it should provide the system look and feel by default but WPF already reimplements the whole common controls system look and feel while still allowing user replacements, so why not allow user replacements of dialogs as well?

Though considering the activity on the WPF repo this point is probably moot anyways, all activity moved to WinUI.

@fabiant3 fabiant3 added the API suggestion Early API idea and discussion, it is NOT ready for implementation label May 19, 2020
@fabiant3 fabiant3 added this to the Future milestone May 19, 2020
@RussKie

This comment was marked as outdated.

@miloush
Copy link
Contributor

miloush commented Oct 12, 2020

@RussKie the dependencies might not be very obvious, maybe it would be helpful to point them out?

Andrej123456789 added a commit to ringwormGO-organization/Termi that referenced this issue Feb 20, 2022
@miloush
Copy link
Contributor

miloush commented Nov 9, 2022

I am in need of using TaskDialog too and I am willing to contribute it to WPF, that is, the Win32 API wrapper.

@RussKie AFAIK WPF depends on Winforms only through WindowsFormsIntegration (for obvious reasons) and through PresentationUI (for document signing and other DRP dialogs). Most WPF applications therefore do not have Winforms loaded and I sympathize with the reluctance to load a 13 MB assembly just to pinvoke an OS dialog.

I would however be interested in what features of TaskDialog people use @mveril and others? Most notably, do you need to modify the dialog content while its shown? Do you add extra controls? Because my needs would be already satisfied by having an API similar to MessageBox, i.e. a static method like

int? TaskDialog.Show(Window owner, string instruction, string content, string caption, params string[] commandLinks)

showing e.g.

image

and returning simply the index of the commandLink clicked.

@RussKie
Copy link
Member

RussKie commented Nov 10, 2022

WPF isn't dependent on Windows Forms at runtime, I've corrected my statement above.

That said, both WPF and Windows Forms are part of the Windows Desktop workload, and they are bundled together. You can see that under C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\<version>\. So, there's no real overhead for a WPF app to reference Windows Forms assembles (or the reverse). Besides self-contained scenarios, perhaps.

@DanFTRX
Copy link

DanFTRX commented Nov 10, 2022

Self contained is a pretty big scenario though.

@RussKie
Copy link
Member

RussKie commented Nov 10, 2022

Windows Forms is still there:

md selfcontained
cd selfcontained
dotnet new wpf
dotnet build
dotnet publish --self-contained
selfcontained>cd bin\Debug\net7.0-windows\win-x64\publish

selfcontained\bin\Debug\net7.0-windows\win-x64\publish>dir /b/s system.windows.forms.dll
selfcontained\bin\Debug\net7.0-windows\win-x64\publish\System.Windows.Forms.dll

@Molinarius
Copy link

I would however be interested in what features of TaskDialog people use

I use title, main instruction, command links with a note, progress bar, timer event, hyper links, main icon, window icon, footer, footer icon, verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API suggestion Early API idea and discussion, it is NOT ready for implementation
Projects
None yet
Development

No branches or pull requests

9 participants