user3284567
user3284567

Reputation: 11

Save File Dialog boxes in VB WPF

In Windows Forms it seems there are precreated dialog boxes for opening and saving files. That is greyed out in the WPF toolbox. Is there an easy way to create such a dialog box using WPF?

Upvotes: 1

Views: 540

Answers (2)

Mark Feldman
Mark Feldman

Reputation: 16119

Have a look at OOkii Dialogs, it's a free library that supports a large range of "standard" and custom dialogs designed for both Winforms and WPF.

Upvotes: 0

Dean Kuga
Dean Kuga

Reputation: 12119

Yes, but you have to add a reference to Microsoft.Win32 and use the OpenFileDialog class which will initiate the same OS dialog you'd get from Winforms...

var ofdXlsDataSource = new OpenFileDialog
{
    CheckPathExists = true,
    CheckFileExists = true,
    Multiselect = false,
    Filter = "Excel documents (*.xlsx)|*.xlsx",
    RestoreDirectory = true
};

if (ofdXlsDataSource.ShowDialog() == true)
{
    ...
}

Upvotes: 1

Related Questions