How to expand gdbprojectitem in catalog

382
1
08-10-2020 12:14 AM
by Anonymous User
Not applicable

Hi Guys,

One of my user has many feature classes (100 and above) in particular sde connection.

I got a requirement to select one of the feature class from selected sde connection dynamically.

I use the following code and try to select the feature class on the fly.

It only achieve if user expand the gdb /sde connection project item.

If user does not expand the gdb item, this.SelectedConnection.GetItems() does not return child items (feature class items)

Any advice how to expand the gdbprojectitem? Uma HaranoWolfgang Kaiser

It need to be support for gdb or folderconnection contatiner and I am using version 2.5

try
            {
                ArcGIS.Desktop.Core.IProjectWindow projectWindow = Project.GetCatalogPane(true);
                Item currentSelectedItem = await (QueuedTask.Run(() =>
                {
                   
                    string finderPath = Path.Combine(this._gdbPath, this.SelectedFC.FeatureClassName);
                    return this.SelectedConnection.GetItems().FirstOrDefault(x => x.Path.Equals(finderPath, StringComparison.OrdinalIgnoreCase));
                }));

                if (currentSelectedItem != null)
                {
                    await projectWindow.SelectItemAsync(currentSelectedItem, true, true, null);
                }
            }

Best Regards,

Than

Tags (1)
0 Kudos
1 Reply
by Anonymous User
Not applicable

I updated the complete code I used.

This is working with gdb/sde connection is under folder connection container. (this.SelectedConnection item)

If it is under gdb database container, it is trying to expand the folder container (if exist), if folder container does not exists, it does not expand and focus at all, currentSelectedItem is null.

ArcGIS.Desktop.Core.IProjectWindow projectWindow = Project.GetCatalogPane(true);
this.SelectedConnection = currentProjectWindow.SelectedItems.First();
                Item currentSelectedItem = await (QueuedTask.Run(() =>
                {
                   
                    string finderPath = Path.Combine(this._gdbPath, this.SelectedFC.FeatureClassName);
                    return this.SelectedConnection.GetItems().FirstOrDefault(x => x.Path.Equals(finderPath, StringComparison.OrdinalIgnoreCase));
                }));

                if (currentSelectedItem != null)
                {
                    await projectWindow.SelectItemAsync(currentSelectedItem, true, true, this.SelectedConnection);
                }
0 Kudos