It looks like the shapefile you're using is a Polygon shapefile, but you're providing a Line symbol.
Try setting a SimpleFilleSymbol instead. If you just want an outline, use a SimpleFillSymbol and set its Outline to that SimpleLineSymbol you've got, then set the SimpleFillSymbol style to .Null.
Hi Nicholas -
This code is from the sample, unaltered. I was hoping the sample shows that there's a default renderer being applied behind the scenes (like the way arcobjects does it), and that providing an inappropriate renderer (like a simplerenderer with a linesymbol for a polygon layer) would cause it to revert to the default renderer.
However, if I comment out the line where the _shapefileSublayer.Renderer is being set, nothing in the layer gets displayed. So I guess there's no default, so we're required to set an appropriate renderer, even though this example shows an inappropriate one might still draw something.
Is there a general way (for both shapefiles and enterprise featureclasses) to determine the geometrytype of a TableSublayerSource so that I can create an appropriate renderer?
Granted I'm not familiar with the Local Server samples (I'm an iOS Runtime kind of guy and we don't have Local Server) so I could be mistaken, but it looks like a bug in the sample, tbh. I imagine the sample is opening a shapefile, and you picked one with polygons in it. If you try to render a polygon class with a line symbol, you'll likely not see what you want.
See this sample which is rendering the same Subdivisions shapefile, albeit without Local Server in the mix.
But again, I could be wrong. Do try setting up the _shapefileSublayer.Renderer with a polygon symbol as per the other sample and see if that works. But it looks like either the sample or the SDK is broken.
The sample assumes you're using the sample data that's associated with that sample - it's just showing a discreet workflow.
To make the workflow more generic, you could take a look at the `ArcGISSublayer.MapServiceSublayerInfo` Property and create some conditional logic based on the `ArcGISMapServiceSublayerInfo.GeometryType`.
I will also say the recommended option for accessing Shapefiles is to use ArcGIS Runtime directly rather than go via the Local Server component.
Hi Michael -
After I get this working, I intend to generalize it to work with EnterpriseWorkspace too. I'm trying to make a workaround for BUG-000120203.
So to get the geometrytype, it looks like I need to call LoadAsync on the sublayer first.
So I changed this code in the sample:
... and get the Illegal state error.
Am I doing something wrong?
I'm assuming it would get the same error with an SDE workspace too, but will try to confirm.
Also, if I just make a single change to the sample (without changing anything else) I see that LoadStatusChanged never fires. Shouldn't we expect this to fire?