First, you need to import a reference to the File Dialog Service:
[Import(SoapBox.Core.Services.FileDialog.FileDialogService,
typeof(IFileDialogService))]
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
}
answered
01 Jun '10, 21:45
Scott Whitlock ♦♦
696●25●28●33
accept rate:
52%