Select to view content in your preferred language

Highlighting Graphics through a Gridview

2137
5
04-26-2013 01:27 PM
Labels (1)
BKuiper
Frequent Contributor
Hi,

as an extension on my question raised here "" (Rad)GridView and displaying the attributes of all the Graphics

I'm trying to highlight Graphics through a (rad)gridview, just as it is done in ArcMap. I have attached a screenshot as example.

I have achieved populating the Gridview by creating a datatable and populating the attributes as datacolumns and having a reference to the GraphicsLayer. I couldn't find a way to directly hook the GraphicsLayer into the Gridview, by using a DisplayMemberPath or something similar, to get to the Graphics and its underlying Attributes properties. So i had to create this DataTable structure.

Now I want to make sure that on selection of a row in the DataGrid the Graphic is highlighted. This is working by getting the datarow from the selection and finding the column that holds the actual Graphic. Then I set Graphic.Selected = True. This works!

Now i run into the problem when i want to do this for 2500 items at once (ctrl+A / select all, for example with a grid of data points as shown in the attachment). This takes forever to load and the UI will hang for 10 till 20 seconds before it returns and shows all the selected items. For completion, I'm using Accelerated Display.

Any idea on how i can improve the performance ? should I perhaps reconsider how the binding is done to the grid ? I don't think this will matter to much though.

Thanks!
0 Kudos
5 Replies
BKuiper
Frequent Contributor
testing shows that if I remove the layer from the map, set all (2500) graphics to selected and reload the map, it still takes very long (10-20) seconds to load.

This makes me believe the way the graphic.Selected property is bound to the map makes it slow and Esri should perhaps consider a different approach. Any thoughts on this ?
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

When the graphics aren't bound to a FeatureDataGrid selection is very fast (I tested up to 3500) - so it's the binding between the GraphicsLayer and the FeatureDataGrid that introduces the delay (I saw approx. 9 seconds delay in when selecting all graphics either in the map or in the data grid).

You can download the source code for the WPF FeatureDataGrid here - http://esrisilverlight.codeplex.com. Perhaps there's a way to optimize the selection.

Cheers

Mike
0 Kudos
BKuiper
Frequent Contributor
I'm not sure if i completely understand your comment. I'm currently not using the FeatureDataGrid. But you made a good point. I haven't looked at the source code of the FeatureDataGrid and will examine it.
0 Kudos
BKuiper
Frequent Contributor
I don't think looking at the FeatureDataGrid will help much. I think the problem is probably overall WPF performance when calling ChangeVisualState on each Graphic when it is selected.

I don't get the performance you are referring too.

Any thoughts?
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Without a FeatureDataGrid (or other UI control bound to the graphics collection) selecting/unselecting 2500 graphics takes 0.1seconds on my machine (reasonably fast laptop).

With a FeatureDataGrid bound to the graphics collection this time increases significantly - I am investigating further.

What datagrid-style control are you using? Can you provide a reproducer app?

Cheers

Mike
0 Kudos