AnsweredAssumed Answered

How to use GraphicsSource property in an ArcGISLocalFeatureLayer?

Question asked by xtian79 on Apr 3, 2014
Latest reply on Apr 4, 2014 by MBranscomb-esristaff
DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far???

I am creating an ArcGISLocalFeatureLayer, but i want to use the GraphicsSource property due an MVVM approach:
                var localCenterlineServiceMPK = new LocalFeatureService                                                     {                                                         Path = @"myPackage.mpk",                                                         MaxRecords = 100000                                                     };                  localCenterlineServiceMPK.Start();                  var lineLayer = new ArcGISLocalFeatureLayer                                     {                                         Url = localCenterlineServiceMPK.UrlFeatureService + "/0",                                         Service = localCenterlineServiceMPK,                                         ID = "mylayerName",                                         LayerName ="mylayerName",                                         Editable = true,                                         DisableClientCaching = true,                                         AutoSave = false,                                         Mode = FeatureLayer.QueryMode.Snapshot,                                         OutFields = new OutFields { "*" },                                         Graphics = null,                                         GraphicsSource = graphics                                     };                 lineLayer.Initialize();


when the line of the creation is hot, then it throws the following exception:

System.InvalidOperationException occurred   HResult=-2146233079   Message=Graphics collection must be empty before using GraphicsSource.   Source=ESRI.ArcGIS.Client   StackTrace:        at ESRI.ArcGIS.Client.FeatureLayer.OnGraphicsSourceChanged(IEnumerable`1 oldValue, IEnumerable`1 newValue)   InnerException:


I had try to set the Graphics property to null, clear it, but the exception is the same in both cases....the documentation was checked...and i do not see anything related

Outcomes