Is it possible to set the OpenItemDialog to show only local items and not show anything from the portal?
usually, by default, Portal isnt shown - at least in my case on v3.1:
OpenItemDialog itemDlg = new OpenItemDialog { Title = "Open Files", InitialLocation = @"E:\Data\Test", MultiSelect = false }; bool? ok = itemDlg.ShowDialog();
if u do _not_ set a filter on the dialog then, by default, on construction, the itemDlg.Filters property shld be set to "esri_browseDialogFilters_gp_all" which excludes the portal "Node" by default....
However, if u need to force the Portal node to not show (because it is showing for some reason) then u can add an explicit "Exclude" to a browse filter:
BrowseProjectFilter bdf = new BrowseProjectFilter(); bdf.Name = "All files (*.*)"; bdf.BrowsingFilesMode = true; bdf.FileExtension = "*.*"; bdf.Includes.Add(@"FolderConnection"); //Does not display Online places in the browse dialog bdf.Excludes.Add(@"esri_browsePlaces_Online"); bdf.BrowsingFilesMode = true; OpenItemDialog itemDlg = new OpenItemDialog { Title = "Open Files", InitialLocation = @"E:\Data\Test", MultiSelect = false, BrowseFilter = bdf }; bool? ok = itemDlg.ShowDialog();
As the default filters usually exclude the Portal node, if you need to _add_ the portal Node, then construct a browse filter that does _not_ exclude it like so:
BrowseProjectFilter bdf = new BrowseProjectFilter(); bdf.Name = "All files (*.*)"; bdf.BrowsingFilesMode = true; bdf.FileExtension = "*.*"; bdf.Includes.Add(@"FolderConnection"); bdf.BrowsingFilesMode = true; //Do not exclude online places //"Exclude" of Online places has been removed... OpenItemDialog itemDlg = new OpenItemDialog { Title = "Open Files", InitialLocation = @"E:\Data\Test", MultiSelect = false, BrowseFilter = bdf }; bool? ok = itemDlg.ShowDialog();
I was using a feature class filter. The exclude example helped me get it working, thanks.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.