3/30/2010 8:29 PM
You can subscribe to this wiki article using an RSS feed reader.

First, you need to import a reference to the File Dialog Service:

    private Lazy<IFileDialogService> fileDialogService { get; set; }

Then you can use that service to get a file name from an Open File Dialog:

    private Dictionary<string, string> filters
        = new Dictionary<string, string>();

    filters.Add("txt", "Text Files");

    bool addExtension = true;
    bool checkFileExists = true;
    bool checkPathExists = true;

    string fileName = fileDialogService.Value.OpenFileDialog(
            "txt", @"c:\", filters,
            "My Open File Dialog Title",
            addExtension, checkFileExists, checkPathExists);
    if(fileName != null)
        // do something

Home: SoapBox Core What's new: Recently changed articles