Usage

// Initializing Open Dialog
Gat.Controls.OpenDialogView openDialog = new Gat.Controls.OpenDialogView();
Gat.Controls.OpenDialogViewModel vm = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;

// Adding file filter
vm.AddFileFilterExtension(".txt");

// Show dialog and take result into account
bool? result = vm.Show();
if(result == true)
{
	// Get selected file path
	File.Text = vm.SelectedFilePath;
}
else
{
	File.Text = string.Empty;
}

// Setting date format by using predefined date format
vm.DateFormat = Gat.Controls.OpenDialogViewModel.ISO8601_DateFormat;

// Setting folder dialog
vm.IsDirectoryChooser = true;
vm.Show();

// Setting save dialog
vm.IsDirectoryChooser = false;
vm.IsSaveDialog = true;
vm.Show();

// Customize UI texts
vm.CancelText = "Abort";
vm.Caption = "Caption";
vm.DateFormat = "yy_MM_dd HH:mm:ss";
vm.DateText = "DateTime";
vm.FileFilterText = "File extension";
vm.FileNameText = "File path";
vm.NameText = "File";
vm.SaveText = "Store";
vm.SizeText = "Length";
vm.TypeText = "File Type";

// Setting window properties
vm.Owner = MainWindow;
vm.StartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

// Show
vm.Show();

Last edited Jan 18, 2013 at 9:09 PM by kittof, version 2

Comments

j0rt3g4 Jun 17, 2016 at 1:15 AM 
Hi thank you for this, is there a way where I can start the "folder browsing" in other location like a special folder ? maybe the desktop?