2

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?

3

A folder is also a workspace (e.g. for shapefiles).

I do not think there is a built-in filter for selecting geodatabases (if that's what you mean). You can pretty easily implement IGxObjectFilter yourself, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.