XSharp.Tools.WPF: dependency on System.Windows.Forms?

This forum is meant for questions and discussions about the XSharp Tools libraries, which contain code written by XSharp users that they want to share with others,
The development team is not responsible for this code

Moderator: wriedmann

User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by wriedmann »

Hello,

currently I'm working on the WPF library, and have encountered a problem: WPF does not provides a dialog to select a folder.
In my own WPF library, I'm using a Windows.Forms dialog.

I have now two possibilities:
  • don't provide a folder selection method
  • add a dependency to System.Windows.Forms
What do you prefer?

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Juraj
Posts: 162
Joined: Mon Jan 09, 2017 7:00 am

XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by Juraj »

Hi Wolfgang

in my WPF app I use System.Windows.Forms.FolderBrowserDialog{}. Adding to a reference is not a problem.
I vote for option two.

Juraj
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by wriedmann »

Hi Juraj,

ok, thank you very much!

1:0 for the dependency to System.Windows.Forms.

The alternative would be to write a WPF folder selection dialog....

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4567
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by robert »

Wolfgang,
https://github.com/aelij/WPFContrib has such a dialog.
I have no idea about the quality of code

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by wriedmann »

Hi Robert,

thank you very much! I have looked at it, and it will take some time to isolate it. Currently this dialog crashes on my system.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
kazmi
Posts: 1
Joined: Wed Sep 20, 2023 6:52 am
Location: Pakistan

Re: XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by kazmi »

Hello,

When deciding whether to provide a folder selection method in your WPF library and considering the use of a Windows.Forms dialog or adding a dependency to System.Windows.Forms, it's essential to weigh the trade-offs and make a decision based on your library's goals and the user experience you want to provide.

Here are some factors to consider for each option:

Option 1: Don't Provide a Folder Selection Method

Pros:

Lightweight: Your library remains lightweight and doesn't introduce any external dependencies.
Consistency: Users who prefer a pure WPF experience may appreciate the consistency of using only WPF components.
Cons:

Limited Functionality: Users may need folder selection functionality, and not providing it could limit the utility of your library.
Option 2: Add a Dependency to System.Windows.Forms

Pros:

Complete Functionality: Adding the dependency allows you to offer folder selection, enhancing the usefulness of your library.
Minimal Effort: Leveraging the Windows.Forms dialog requires relatively little effort compared to creating a custom folder selection dialog.
Cons:

External Dependency: Introducing a dependency on System.Windows.Forms may not align with your library's design principles or goals, and some users may prefer not to include this dependency in their projects.
Inconsistency: Mixing Windows.Forms with WPF may create a less consistent user experience, as the dialog's appearance and behavior may differ from other WPF components.
Ultimately, the choice depends on your library's purpose and target audience. If offering folder selection is essential and aligns with your library's goals, adding the dependency to System.Windows.Forms might be the pragmatic choice. However, if you prioritize a lightweight, pure WPF experience, and folder selection is not a critical feature, you may opt to skip providing this functionality.

Consider providing clear documentation and instructions for users on how to handle folder selection if you choose not to include it in your library. Additionally, you could explore third-party WPF libraries or components that offer folder selection dialogs if you prefer to avoid introducing the System.Windows.Forms dependency.

source cartogeek.com
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by wriedmann »

Hi Kazmi,
thank you for your thoughts!
Currently I have suspended the work on the library because there was not much interest in it, but that may change in the future if more X# users think that WPF is the way to go.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1593
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Re: XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by FFF »

Wolfgang,
if this dlg is the one, where one can ONLY select a folder, I wouldn’t miss it. In fact, I hate it, whenever an app forces me to use it…
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: XSharp.Tools.WPF: dependency on System.Windows.Forms?

Post by wriedmann »

Hi Karl,
please let pass my session in Memmingen, and we will see if there is any interest in a WPF X# GUI library. Maybe now the time could be right (but don't forget the XGUI classes - they promise the same development speed as the VO GUI classes, but based on Windows Forms).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply