Windows 7 for Developers – File Dialogs from .NET

I’m reading Yochay’s posts up at the Windows 7 for Developers blog;

http://windowsteamblog.com/blogs/developers/rss.aspx

It’s all great material – one of the things that I hadn’t been aware of was that if in a WPF application ( on 3.5 Service Pack 1 ) I’m using a file dialog as in;

using System;
using System.Windows;
using winformsDialog = System.Windows.Forms.OpenFileDialog;

namespace WpfApplication1
{
  public partial class Window1 : Window
  {
    public Window1()
    {
      InitializeComponent();
    }
    void OnClick(object sender, EventArgs args)
    {
      winformsDialog dialog = new winformsDialog();

      dialog.ShowDialog();
    }
  }
}

then I get this dialog;

image

whereas if I use this code ( which is what I would naturally do in a WPF application );

using System;
using System.Windows;
using win32Dialog = Microsoft.Win32.OpenFileDialog;

namespace WpfApplication1
{
  public partial class Window1 : Window
  {
    public Window1()
    {
      InitializeComponent();
    }
    void OnClick(object sender, EventArgs args)
    {
      win32Dialog dialog = new win32Dialog();

      dialog.ShowDialog();
    }
  }
}

then I get this dialog which Yochay refers to as the “legacy Common File Dialog” and talks about its limitations versus the previous dialog.

image

That was news to me and there’s a bunch more similar gems up at Yochay’s blog.