Bug: Selection lost when Feature Layer refreshed (Repro sample included)

676
2
09-17-2018 12:15 PM
RichardMcGough
New Contributor II

If I set a refresh interval on a feature layer, any selected feature becomes unselected when the layer refreshes. This appears to be a new bug in ArcGISRuntime 100.3. It doesn't happen in version 100.2. 

The attached repro sample has two buttons. One to create a feature if there aren't any already on the layer, and one to select a feature. Click "Select Feature" and then click on a feature. It should show a blue highlight which will then disappear in a few seconds when the layer refreshes if it is using version 100.3. The selection remains unaffected when using version 100.2.  

Note: You will have to add the ESRI.ArcGISRuntime.WPF NuGet package to the project. I removed it to reduce the size of the file. 

2 Replies
JenniferNery
Esri Regular Contributor

Thanks, Richard for reporting this. I have logged an issue on our end. 

If you are looking to refresh existing features, you might want to use LoadOrRefresh.

I can see how you will need this to get the new features, too. Would QueryFeatures be a substitute? 

I'll post if I find a better workaround but we'll try to get this fixed in future releases of the API.

Thank you.

RichardMcGough
New Contributor II

Thanks for the quick response Jennifer. 

I think I found a good workaround. I simply set the RefreshInterval to zero when the user selects/edits a feature, and then set it back to its configured value when the editing is complete. Seems to work well. The only drawback is that the layer is not updated as long as a feature is selected, so a user could miss updates if they accidentally leave a feature selected. If this turns out to be a problem, I will just add a timer to deselect the feature if there is no user interaction after a fixed interval.   

0 Kudos