ToggleRowSelection does not toggle the right row

07-24-2021 09:31 AM
Occasional Contributor II

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



                <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>

            <ContextMenu x:Key="MyRowContextMenu">
                <MenuItem Header="Select/Unselect" 
                        <Image Source="{StaticResource TableSelectUnselect16}" Width="16" Height="16" RenderOptions.BitmapScalingMode="HighQuality"/>





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






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;                        



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 



0 Kudos
2 Replies
Occasional Contributor III


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.

0 Kudos
Occasional Contributor II

Hi @GintautasKmieliauskas 

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. 

0 Kudos