I added a select/unselect button on the context menu of a table control. I am trying to use TableControlCommands.ToggleRowSelection property but it keeps ignore the active row and select/unselect the first row of the table. Do you have any idea what the reason is for this issue?
Reference to TableControlCommands.ToggleRowSelection
https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic22318.html
<controls:ProWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
<ContextMenu x:Key="MyRowContextMenu">
<MenuItem Header="Select/Unselect"
Command="editing:TableControlCommands.ToggleRowSelection">
<MenuItem.Icon>
<Image Source="{StaticResource TableSelectUnselect16}" Width="16" Height="16" RenderOptions.BitmapScalingMode="HighQuality"/>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</ResourceDictionary>
<editing:TableControl AutomationProperties.AutomationId="_tableControl" x:Name="tableControl"
Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
TableContent="{Binding Path=TableContent, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
RowContextMenu="{StaticResource MyRowContextMenu}"
SelectedRowContextMenu="{StaticResource MyRowContextMenu}"
>
</editing:TableControl>
Amazingly, it works fine on the Selected Record view mode. Another issue exists when making extended selection with Shift+Click. Shift+Click is supposed to select every rows between two highlighted rows. However, it disregards highlighted rows and make the selection from 1st record to last highlighted row. Lets say you want to select rows between oid number 6-10. If you try to select these with Shift+Click, it selects everything up to oid row 10. I hope it makes sense.
I think it is somehow related to ActiveRowIndex as it stays 1 all the time
var oid = _tableControl.GetObjectIdAsync(_tableControl.ActiveRowIndex).Result;
MessageBox.Show(oid.ToString());
I don't know this is a bug or my comp got messed up. Please someone try this and let me know.
Maybe also good time to show some misspellings I have found before
Hi,
I have tried on community sample arcgis-pro-sdk-community-samples/Map-Exploration/TableControl at master · Esri/arcgis-pro-sdk-commun...
I have checked ActiveRowIndex on Zoom to row. ActiveRowIndex works fine. Multiple selection with shift + click selects from old ActiveRowIndex to new ActiveRowIndex.
I don't understand what is going on maybe there is problem with the dataset itself. Thank you for trying this, now I know the issue is not a bug.