I am trying to open a ArcGIS file browser. And For this, I used IGxDialog interface's DoModalOpen method. To specify what the user can select using a GxDialog browser is based on the filters (GxObjectFilter) held by the object. To browse workspace, I set ObjectFilter to GxFilterWorkspaces. But it allows folders that contains layers/feature classes/raster datasets that is not IGxDatabase or IWorkspace.
IGxObjectFilter gxObjectFilter = new GxFilterWorkspaces();
IGxDialog gxDialog = new GxDialog();
gxDialog.AllowMultiSelect = false;
gxDialog.Title = title;
gxDialog.ObjectFilter = gxObjectFilter;
gxDialog.ButtonCaption = "Open";
gxDialog.RememberLocation = true;
IEnumGxObject enumGxObject;
gxDialog.DoModalOpen(0, out enumGxObject);
while ((gxObject = enumGxObject.Next()) != null)
{
if ((gxObject as IGxDatabase2) != null)
{
return gxObject.FullName;
}
}
Question:
What should I do to select only workspace through this browser? Or is there any other option to browse GIS dataset?