LocalMapService localMapServiceTactical = new LocalMapService() { Path = @C:\Data\tactical.mpk, EnableDynamicLayers = true }; // Start the local map service and once initialized localMapServiceTactical.StartAsync((mapService) => { // create a new local dynamic map service layer based on the local map service _arcGISLocalDynamicMapServiceLayer = new ArcGISLocalDynamicMapServiceLayer(localMapServiceTactical) { ID = "Tactical", ImageFormat = ArcGISDynamicMapServiceLayer.RestImageFormat.PNG32, }; // Set up an event handler for the layer initialized event _arcGISLocalDynamicMapServiceLayer.Initialized += (s, e) => { //Enable the UI once the layer has initialized //DynamicLayersUiGrid.IsEnabled = true; DataContext = this; //IsBusy = false; }; // Add the layer to the map _map.Layers.Add(_arcGISLocalDynamicMapServiceLayer); });
ArcGISLocalFeatureLayer arcGISLocalFeatureLayer = null; LocalFeatureService lfs = new LocalFeatureService(); lfs.Path = @C:\Data\tactical.mpk; arcGISLocalFeatureLayer = new ArcGISLocalFeatureLayer(lfs, "Target"); // Set the ID. arcGISLocalFeatureLayer.ID = "Target"; arcGISLocalFeatureLayer.Editable = true; arcGISLocalFeatureLayer.ValidateEdits = true; arcGISLocalFeatureLayer.AutoSave = true; arcGISLocalFeatureLayer.MouseLeftButtonUp += new GraphicsLayer.MouseButtonEventHandler(arcGISLocalFeatureLayer_MouseLeftButtonUp); // Define a SimpleRenderer with a SimpleMarkerSymbol to display each observation. Each observation // will be a small red triangle. ESRI.ArcGIS.Client.SimpleRenderer mySimpleRenderer2 = new ESRI.ArcGIS.Client.SimpleRenderer(); ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol mySymbol2 = new ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol(); System.Windows.Media.SolidColorBrush defaultBrush2 = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0, 0)); //Red mySymbol2.Color = defaultBrush2; mySymbol2.Size = 8; mySymbol2.Style = ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol.SimpleMarkerStyle.Triangle; mySimpleRenderer2.Symbol = mySymbol2; arcGISLocalFeatureLayer.Renderer = mySimpleRenderer2; arcGISLocalFeatureLayer.InitializationFailed += new System.EventHandler<System.EventArgs>(arcGISLocalFeatureLayer_InitializationFailed); arcGISLocalFeatureLayer.Initialize(); // Add the local feature layer to the map. The map will handle the initialization of the layer. map.Layers.Add(arcGISLocalFeatureLayer); ESRI.ArcGIS.Client.Toolkit.EditorWidget editorWidget = null; this.editorWidget = new ESRI.ArcGIS.Client.Toolkit.EditorWidget(); this.editorWidget.Margin = new Thickness(12, 50, 0, 0); this.editorWidget.Map = map; this.editorWidget.AutoSelect = true; this.editorWidget.AlwaysDisplayDefaultTemplates = true; this.editorWidget.VerticalAlignment = System.Windows.VerticalAlignment.Top; this.editorWidget.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; this.editorWidget.ShowAttributesOnAdd = true; this.editorWidget.Loaded += new RoutedEventHandler(editorWidget_Loaded); this.editorWidget.DataContext = arcGISLocalFeatureLayer; this.editorWidget.LayerIDs = layerIDs; this.editorWidget.ApplyTemplate(); LayoutRoot.Children.Add(editorWidget);
The editor widget has a Map property that you have to set. Have you done that?http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Editor_members.html
ESRI.ArcGIS.Client.Toolkit.EditorWidget editorWidget = null; string[] layerIDs = { "Target" }; this.editorWidget = new ESRI.ArcGIS.Client.Toolkit.EditorWidget(); this.editorWidget.Margin = new Thickness(12, 50, 0, 0); this.editorWidget.Map = map; this.editorWidget.AutoSelect = true; this.editorWidget.AlwaysDisplayDefaultTemplates = true; this.editorWidget.VerticalAlignment = System.Windows.VerticalAlignment.Top; this.editorWidget.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; this.editorWidget.ShowAttributesOnAdd = true; this.editorWidget.Loaded += new RoutedEventHandler(editorWidget_Loaded); this.editorWidget.DataContext = arcGISLocalFeatureLayer; this.editorWidget.LayerIDs = layerIDs; this.editorWidget.ApplyTemplate(); LayoutRoot.Children.Add(editorWidget);
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.