code example
var dlg = new SaveItemDialog();
dlg.Title = "title";
dlg.OverwritePrompt = true;
dlg.DefaultExt = "gmcx";
dlg.InitialLocation = @"C:\Temp";
var fileFilter = BrowseProjectFilter.GetFilter("esri_browseDialogFilters_browseFiles");
fileFilter.FileExtension = "gmcx";//restrict to specific extensions as needed
fileFilter.BrowsingFilesMode = false;
//Specify a name to show in the filter dropdown combo box - otherwise the name
//will show as "Default"
fileFilter.Name = "(*.gmcx)";
dlg.BrowseFilter = fileFilter;
bool? saveFile = dlg.ShowDialog();
if (saveFile == true)
{
NewCatalogPath = dlg.FilePath;
}
I have a custom Item with a .gmcx extension, and I have created a BrowseProjectFilter to limit
the browsing to files with .gmcx extensions.
The issue I would like to fix if possible is that the user can type into the Name textbox, enter a
path using a directory that doesn't exist and yet the Save button is available and FilePath returned
is using a non-existant directory.
See the attached image as an example. The user can enter c:\directoryThatDoesNotExist\newgmcx and
clicking the Save button returns a dlg.FilePath of c:\directoryThatDoesNotExist\newgmcx.gmcx
Is there a way to have the dialog validate that everything left of newgmcx actually exists before
saveFile == true?
When this was tried using microsoft's SaveFileDialog, a warning is given and the workflow stopped.
See second attachment.
Thanks for your help