TableControl does not return selected row

890
4
09-21-2021 02:43 AM
TomGeo
by
Occasional Contributor III

In my addin I visualize the attribute values of a feature layer in a TableControl. Until recently the whole setup worked fine, and for whatever reason does the addin not work any more correct. I can show the attribute values of the feature layer, but when I try to retrieve the selected row in the TableControl then nothing comes back.

To utilize the TableControl I define the namespace in the xaml file:

 

xmlns:editing="clr-namespace:ArcGIS.Desktop.Editing;assembly=ArcGIS.Desktop.Editing"

 

and add the control:

 

<editing:TableControl Grid.Row="2" x:Name="tableControl"
                                      AutomationProperties.AutomationId="_tableControl"
                                      HorizontalAlignment="Stretch"
                                      TableContent="{Binding Path=TableContent}"
                                      MinHeight="450"
                                      MaxHeight="500"
                                      RowContextMenu="{StaticResource StepperRowContextMenu}"
                                      SelectedRowContextMenu="{StaticResource StepperRowContextMenu}"
                                      ColumnContextMenu="{StaticResource StepperColumnContextMenu}">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="MouseDoubleClick">
            <i:InvokeCommandAction Command="{Binding ZoomItemCommand}"/>
        </i:EventTrigger>
        <i:EventTrigger EventName="SelectedRowsChanged">
            <i:InvokeCommandAction Command="{Binding GetSelectedRowCommand}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</editing:TableControl>

 

I am getting an XDG0008 error from the component, saying the name "TableControl" does not exist in the namespace "clr-namespace:ArcGIS.Desktop.Editing;assembly=ArcGIS.Desktop.Editing".

Even though it is claimed the component does not exist within the namespace, the component is shown in the addin, populated with data, and then when I change the selected row nothing happens. Every time the selected row is changed I ask the TableControl to return the selected row indexes:

 

public async Task SelectedRowForStepper()
        {
            IReadOnlyList<long> curSelectedRowList = await QueuedTask.Run(() => _tableControl.GetSeletedRowIndexes());
            
            if (curSelectedRowList.Any())
            {
            	...

 

here, _tableControl is of type TableControl and its content was created through TableControlContentFactory.Create(workLayer), where worklayer is of type MapMember.
The resulting content object contains the correct value in its MapMember property. However, when running _tableControl.GetSeletedObjectIds() as List<long>) the list has a count of zero.
When I look at _tableControl at the point when one of the rows is selected, then _tableControl has the following property values:

  • TableContent: null
  • RowCount: -1
  • ActiveFieldIndex: null
  • ActiveRowIndex: -1

How can it be, that I do get these values, even though the table is populated with correct data, the control itself counts 234 items/rows in it, and when I select one or more rows the count of selected rows is shown correctly in the bottom of the control as e.g. "1 of 234"?

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
Tags (1)
0 Kudos
4 Replies
NarelleChedzey
Esri Contributor

Hi Thomas, 

Can you tell me what version of ArcGIS and the Pro SDK you are using?

Also what type of data you are displaying in the table.  Is it file gdb, SDE data, feature service data?

 

The xaml error that you are getting "TableControl" does not exist in the namespace "clr-namespace:ArcGIS.Desktop.Editing;assembly=ArcGIS.Desktop.Editing".   is something that you can ignore.  As you are aware you can compile and run your project despite this error message.  The messages are coming from the 'XAML Designer' and if you close all XAML windows and rebuild you shouldn't get any messages.  In 2.8 all Pro assemblies were switched from mixed (x86 and x64) to 64 bit only. Unfortunately the XAML designer loader cannot load x64 bit assemblies.   Hopefully the upcoming release of Visual Studio 2022 will fix this issue.

 

With regards to the other problems, I am not seeing any issues with the GetSelectedRowIndexes or GetSeletedObjectIds methods in my test (I am using file gdb data),  Knowing which release and what type of data you are using will allow me to help track it down further. 

 

Also when checking the properties of the tableControl is your breakpoint on the UI thread or the background thread?   

 

Thanks

Narelle

 

0 Kudos
TomGeo
by
Occasional Contributor III

Hi Narelle,

thanks for your fast reply.

We are running ArcGIS Pro version: 2.8.1 and the addin is currently build with ArcGIS Pro SDK version: 2.8.0.29751.

With respect to the data source, I display QueryLayer, data request goes to an Oracle database.

The breakpoint is directly on line 3 in the SelectedRowForStepper method. Hence, I believe I am looking at the TableControl object that should hold the information visualized in the UI.

 

Thank you so much for looking deeper into things.

Bests Thomas

 

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
0 Kudos
NarelleChedzey
Esri Contributor

Hi Thomas, 

Is there anything else you can tell me about the queryLayer that you have.  Are you displaying the entire data from the Oracle feature class or does the query layer have a where clause so that only a subset of data is displayed.  Do you happen to know what version of Oracle is being used?  

 I have connected to an Oracle database and loaded a querylayer with a point feature class.  I have tested on a 2.8.1 build of ArcGIS Pro and am not seeing any problems with the TableControl or it's properties. 

In your original post you mention "Until recently the whole setup worked fine, and for whatever reason does the addin not work any more correct."     Did you perform any software upgrades in the timeframe that you noticed it stopped working.  Or made additional changes to the add-in?   

Finally, would you be able to share your entire visual studio project with me.  That might help me find the problem. 

 

Narelle

0 Kudos
TomGeo
by
Occasional Contributor III

Hi Narelle,

about the QueryLayer, I do not display the entire data of the oracle table, but have a where clause in.

 

SELECT * FROM SCHEMA1.TABLE1 WHERE FEATURETYPE = 'turbine' AND EXISTS (SELECT 1 FROM SCHEMA2.TABLE2 v WHERE v.LOCALID = TO_CHAR(OTLOCALID) AND TRUNC(v.REGISTRATIONFROM, 'MI') = TRUNC(TO_TIMESTAMP_TZ(TO_CHAR(FROM_TZ(CAST(OTREGISTRETIONFROM AS TIMESTAMP), 'Europe/Copenhagen'),'YYYY-MM-DD HH24:MI:SS,ff6 TZH:TZM'),'YYYY-MM-DD HH24:MI:SS,ff6 TZH:TZM'), 'MI')) ORDER BY OBJECTID

 

 

I set the unique identifier through

 

queryDescription.SetObjectIDFields("OBJECTID");

 


Our current version of Oracle is Oracle Database 18c EE Extreme Perf Release 18.0.0.0.0 - Production
Version 18.10.0.0.0 

and yes, we had changes in our infrastructure. I only touched the add-in because the location of the Oracle server changed in connection with an upgrade from version 12.1.0.1.0, and since then the add-in goes haywire.

Thomas

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
0 Kudos