How to create a filegeodatabase browse dialog

1039
3
10-26-2018 04:34 AM
JörgEbert
New Contributor II

I would like create a browse dialog only for filegeodatabases as in ArcGIS Pro Catalog 'New File Geodatabase' in my addin.
Using ArcGIS.Desktop.Catalog.OpenItemDialog with ItemsFilter.geodatabases it is possible to select all types of geodatabases.
Do exists a special dialog for file geodatabases? or
Is it possible to programm a custom ItemsfFilter object? or
Is there a nother way to get a filegeodatabse browse dialog?

Tags (2)
3 Replies
UmaHarano
Esri Regular Contributor

Hi

Check out this sample:  DatastoresDefinitionsAndDatasets

It will show you how to create a browse dialog only for Filegeodatabases.

It also shows you a few other filters you can use with the OpenItemDialog dialog.

Here is the list of all the filters: ItemFilters

Thanks

Uma

JörgEbert
New Contributor II

Hi,

thanks for the answer, but in my opinion that can only be a workaround.
It is not user-friendly, if any geodatabase type can be selected and only after the selection comes the warning "only filegeodatabases are supported"
As seen in the image below, the filegeodatabases filter exists in ArcGIS Pro.
Why can not refer to the filegeodatabases filter in the ArcGIS Pro SDK?

ArcGIS Pro New FileGDB Dialog

DanielL
New Contributor II

I was able to achieve this by using BrowseProjectFilter:

BrowseProjectFilter browseFilter = new BrowseProjectFilter()
{
    Name = "File Geodatabases"
};

//allow FGDBs to be selected
browseFilter.AddCanBeFlag(BrowseProjectFilter.FilterFlag.FGDB);

//exclude everything else
string[] names = Enum.GetNames(typeof(BrowseProjectFilter.FilterFlag));
foreach (string name in names)
{
    BrowseProjectFilter.FilterFlag ff =                                                                                                                                        (BrowseProjectFilter.FilterFlag)Enum.Parse(typeof(BrowseProjectFilter.FilterFlag), name);
    if (name != "FGDB" && name != "Container" && name != "Workspace" && name != "Database" && name        != "DontBrowseFiles")
    {
        browseFilter.AddDontBrowseIntoFlag(ff);
    }
}

OpenItemDialog dialog = new OpenItemDialog()
{
    Title = "Select Output FGDB",
    MultiSelect = false,
    BrowseFilter = browseFilter,
};
dialog.ShowDialog();

0 Kudos