What is WPF equivalent of the open folder dialog of WindowsForms?

G

Guest

Hi,

I am trying to enter the WPF world and stumbled when I needed the
functionality of browseing to choose a certain folder, a very common
component in Windows.Forms applications.

Is there a corresponding component for WPF development? I suppose I could
just add the Windows.Forms assembly toi my project, but that would make my
WPF application very platform specific wouldn't it?
 
R

RobinS

Juan Dent said:
Hi,

I am trying to enter the WPF world and stumbled when I needed the
functionality of browseing to choose a certain folder, a very common
component in Windows.Forms applications.

Is there a corresponding component for WPF development? I suppose I could
just add the Windows.Forms assembly toi my project, but that would make
my
WPF application very platform specific wouldn't it?

Don't you think WPF is already kind of platform-specific? Where do you
think you are going to run WPF applications that WIndowsForms won't run?

According to Nathan's book: "Both WindowsForms and WPF define managed
classes that wrap Windows common dialogs, except ColorDialog, FontDialog,
and FolderBrowser, which only occur in Windows. The easiest way to use
these omitted dialogs is to use the ones from Windows Forms."

Good luck.
Robin S.
 
J

Jeffrey Tan[MSFT]

Hi Juan,

Yes, based on my knowledge, there is no build-in class support in current
version of WPF. I would recommend you to use the one from .Net2.0 Winforms
Forms assembly.

Actually, there is no problem of using .Net2.0 assemblies in WPF. .Net3.0
does not have its own CLR, it still leverages .Net2.0 CLR, and other
..Net2.0 core library assemblies. So it can be seen as a new service built
on the .Net2.0. My original reply below contains more information:
http://groups.google.com/group/microsoft.public.dotnet.general/msg/107c5888d
cbb2441

Since the .Net3.0 WPF must be built upon .Net2.0 CLR and FCL, whatever
machine with .Net3.0 installed must have .Net2.0 either. So using .Net2.0
Winforms Forms assembly in WPF has no platform requirment/dependency on the
target machine.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Juan ,

Oh, further research shows that WPF PresentationFramework.dll assembly
introduces Microsoft.Win32.OpenFileDialog class to allow a user to specify
a filename for one or more files to open. You may use it directly in WPF.

Additionally, you should be aware that the WPF APIs only wrap the XP-style
dialogs, even on Windows Vista. The "Vista Bridge", provided in the Windows
SDK, includes a reference sample of how to get Vista-style dialogs from WPF.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top