Recreating editable FeatureDataGrid (WPF) in Xamarin/Android

07-20-2019 07:14 AM
New Contributor

This is a follow-on to the questions raised in mobile package, feature layers are not editable  :

[Please note: I am using the phrase "edit/update" in the sense of changing non-spatial attribute data for a feature class for display purposes only.]

We have a WPF application with a Map consisting of 3 layers: ArcGISLocalTiledLayer (loaded from local .tpk), ArcGISLocalFeatureLayer (loaded from a local .mpk) and a GraphicsLayer that is bound to a FeatureDataGrid. The user is able to view the attributes from the ArcGISLocalFeatureLayer in the FeatureDataGrid, update the non-spatial data, e.g. population, and then the changes are rendered onto the map through the graphics layer. This code works in a totally disconnected environment.

I am trying to recreate this scenario on the Xamarin platform for Android, for a situation where there may be no access to the internet, i.e. map packages must be preloaded onto the device.

I tried using a geodatabase (uploaded as a SQLite DB) and display the attribute data in a GridView - the initial data values are displayed correctly on the map, but any edits to the GridView cannot be updated back into the database (UpdateIndexEntry error). I then tried to load the feature layer as a mobile map package, but have now found that it is also not editable).

Question 1: In the light of the comments in the earlier post - am I correct in concluding that unless the map package is downloaded from a portal item at runtime and the OfflineMapTask is used, the feature layer cannot be edited, even if there is no requirement to sync the edits with the portal item?

Question 2: If my conclusion in 1. is correct - how does the WPF FeatureDataGrid allow "edits" that are rendered onto the map?

Question 2: Other than the separate GridView / TableLayout controls for Android, is there a way to recreate the bound attribute table action of the WPF FeatureDataGrid on Android?

Question 3: Do you have a release date for the 100.5 .Net / Android Runtime Toolkits?

Thank you!

0 Kudos
3 Replies
MVP Regular Contributor

Without seeing example of how you did things, and only limited knowledge of the Toolkit...

The way you describe things you had bound the GraphicsOverlay to the Datagrid and the Graphic within the GraphicsOverlay is also what was being used for symbolization.  The updates you made were reflected in the GraphicsOverlay not in the data table itself.  But because this is what is driving the symbols you see the behavior you describe.  In a way a Graphic is like a really lightweight feature, it has a geometry, attributes and a symbol but no backing data store it just lives in memory 

You could do a pretty similar thing in Xamarin.  There is no FeatureDataGrid from the toolkit, but you could create a ListView that is bound to the GraphicsOverlay.Graphics.

Question 1:

Yes this is correct, in that the FeatureLayer that is created from the FeatureTable cannot be edited.

Question 2:

See the above description

Question 3:

??? - I think there is a 100.5 version, I just don't think they have a FeatureDataGrid for Xamarin.

Some other things.  There is no reason a Runtime MapPackage needs to be generated onto the device itself.  If you have a workflow to copy an ArcGIS Pro MapPackage to the device, you could write a standalone tool in Runtime to generate the package (it's pretty simple) and then copy those packages to the device.

Even if you could edit the sqlite database directly you would not achieve the desired results. Changes to the underlying table would not immediately be reflected in the FeatureLayer because the API is not refreshing if changes are not made through the API.  [As a note, the reason for what you see is that there are triggers on the tables which would seem to use custom functions which are part of Runtime so the errors you see occur when you try to update through the sqlite API)

0 Kudos
New Contributor

Thank you for the feedback, Joe, I will try the graphics overlay route to see if that resolves the issue

re: runtime toolkit - There is a 100.5 runtime toolkit for IOS (release April 2019) but none yet for .Net  - the last toolkit relase was for 100.4 in Nov 2018. [See comment on  Nuget package suggests 100.5 compatibility  “We hope to have a v.100.5 out soon but working through some remaining issues (mainly with Legend on Xamarin)”

In terms of our workflow - we are investigating the feasibility of preloading map content onto an SD Card for a disconnected demo app - there is no connection to Portal or AGOL.

0 Kudos
MVP Regular Contributor

You could always download the code from github, update to 100.5, and compile yourself if you have an immediate need.

0 Kudos