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"?