|
POST
|
Thanks for your clarification. I loaded the code public Map Map { ... } into my usercontrol class: ClosestFacilityControl. but received another error for the 'ClosestFacilityControl', which is the same as my usercontrol's name. The error message shows that The type or namespace name 'ClosestFacilityControl' could not be found. (are you missing a using directive or an assembly reference?) Whatdoes it mean? Thanks.
... View more
10-28-2010
09:19 AM
|
0
|
0
|
1981
|
|
POST
|
In the Usercontrol's xaml, several GraphicsLayers are defined in the map, like that: <esri:Map x:Name="_Map" Background="White" Extent="-117.23,34.03,-117.16,34.08" > <!--<esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>--> <esri:GraphicsLayer ID="MyRoutesGraphicsLayer" Renderer="{StaticResource RouteRenderer}" > <esri:GraphicsLayer.MapTip> <Border CornerRadius="10" Background="#DDFFEEEE" BorderThickness="5" BorderBrush="#7700FF00"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="10"> <StackPanel Orientation="Horizontal"> <TextBlock Text="From Incident " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/> <TextBlock Text="{Binding [IncidentID]}" HorizontalAlignment="Left" VerticalAlignment="Center" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="To Facility " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/> <TextBlock Text="{Binding [FacilityID]}" HorizontalAlignment="Left" VerticalAlignment="Center" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Total Time (mins): " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center" /> <TextBlock Text="{Binding [Total_Time], StringFormat=\{0:F\}}" HorizontalAlignment="Left" VerticalAlignment="Center" /> </StackPanel> </StackPanel> </Border> </esri:GraphicsLayer.MapTip> </esri:GraphicsLayer> <esri:GraphicsLayer ID="MyIncidentsGraphicsLayer" /> <esri:GraphicsLayer ID="MyBarriersGraphicsLayer" /> <esri:GraphicsLayer ID="MyFacilitiesGraphicsLayer" /> </esri:Map> Per your post, I should remove this piece of code and then use public Map Map { ... } Is it right? If so, how can I define these graphicslayers? Thanks.
... View more
10-28-2010
07:11 AM
|
0
|
0
|
1981
|
|
POST
|
I don't think you can since a label.text is actually sourced from a record's value that is entered in English.
... View more
10-28-2010
07:05 AM
|
0
|
0
|
1674
|
|
POST
|
Jennifer: Thanks for your response. Per your advise, I am trying to fix the problem step by step. First of all, in the MainPage, the code was revised as: <local:ClosetFacilityControl x:Name="MyClosedFacility" Visibility="Collapsed" Height="240" Width="440" Canvas.Left="306" Canvas.Top="140" DataContext="{Binding ElementName=MyMap}" _Map="{Binding ElementName=MyMap}" /> However, I received the error that: the property '_Map' does not exist on the type 'ClosetFacilityControl' in the XML neamspace ... Actually, in my ClosetFacilityContro.xaml, the '_Map' is defined like that: <Grid x:Name="LocalPanel" Style="{StaticResource DialogBaseItemsGrid}"> <esri:Map x:Name="_Map" Background="White" Extent="-117.23,34.03,-117.16,34.08" > .... </esri:Map> Please point out what is wrong about my coding. Many thanks.
... View more
10-28-2010
05:56 AM
|
0
|
0
|
1981
|
|
POST
|
In operating some usercontrol tools, I have to zoom-in, zoom-out or pan the map. For example, after doing 'Pan Map', the cursor's stauts retains till I select another nevigation tool, rather than returns to normal (for example for a map click). Please help if you know how to do it. Thanks.
... View more
10-27-2010
06:07 AM
|
0
|
3
|
830
|
|
POST
|
Title should be How to bind to MainPage's map? --------------------------------- This is the continuation of the thread: http://forums.arcgis.com/threads/15556-ClosedFacility?p=49147#post49147. The scenario is described below: 1) Create a UserControls file by loading the ClosedFacility component from ESRI: http://help.arcgis.com/en/webapi/sil...losestFacility 2) In the usercontrol xaml, I defined <esri:Map x:Name="_Map" Background="White" Extent="-117.23,34.03,-117.16,34.08" > 3) Add some code in MainPage.xaml and MainPage.xaml.cs to load the ClosedFacility dialog when it is needed. Also set this component's _Map is set to the same as the parent's map. Results obtained: All of the buttons are disabled. I reported this incident. ESRI's Jennifer responded me that: "All the buttons have Command binding which can only be resolved if their DataContext is resolved. In this sample, each button's DataContext is set to an Editor which is part of Resources. Each of these editors has their Map property bound to a map, using Element binding. Since you are moving this to a different UserControl that does not contain your map, Element binding will not work. You need to resort to other means of binding. Maybe create your own DependencyProperty (Map) in the UserControl so that you can use this instead. " Per her advise, I revised the code (only 1 line here) in the usercontrol's xaml: <esri:Editor x:Key="MyBarriersEditor" LayerIDs="MyBarriersGraphicsLayer" Map="{Binding ElementName=_Map}" /> to: <esri:Editor x:Key="MyBarriersEditor" LayerIDs="MyBarriersGraphicsLayer" Map="{Binding ElementName=MainPage.MyMap}" /> But it still does not work. I believe that the binding is not right. It is somehow chanllege for me and I have very limited experience on it. Do you know how to bind the usercontrol's map to the MainPage's map? Thanks.
... View more
10-27-2010
05:54 AM
|
0
|
16
|
3715
|
|
POST
|
Jennifer: I checked the reference link you provided and but not successful. In debugging, I tried to track the values of the buttons (e.g. one of them is the FacilityRadioButton). The FacilityRadioButton.IsEnbled is always 'false' even though I tried this.FacilitiesRadioButton.IsEnabled = true; in the constructor. I tried find where how the buttons are set initially but no clue has been obtained from the existing code. I can't understand that why the ClearButton.IsEnabled = true always. Wish you can provide some clues if you can. Thanks. Shaning
... View more
10-26-2010
07:35 AM
|
0
|
0
|
652
|
|
POST
|
Problem solved by change map.removeLayer(lyr); to map.removeLayer(map.layers);
... View more
10-25-2010
11:06 AM
|
0
|
0
|
2609
|
|
POST
|
Scenario description: Created several checkboxes. If a checkbox is checked, a layer is added, or else, the layer will be removed (see the code below). However, I can't remove the added layer(s). I run debugging, it does go through map.removeLayer(lyr), but the layer I created is still on the map. If you have a better approach or find anything wrong in my code, please help. Thanks. private function ChkSettings (chk:ImageCheckBox, lyr:GraphicsLayer, ac:ArrayCollection, lyrName:String ):void { if (chk.selected == false) { lyr.clear(); for (var i:Number = 0; i < map.layers.length; i++) { if (map.layers.name == lyrName) { map.removeLayer(lyr); } } } else { lyr = AddGeocodeLayer2(ac); lyr.name = lyrName; map.addLayer(lyr); } }
... View more
10-25-2010
09:40 AM
|
0
|
3
|
10651
|
|
POST
|
Jennifer: Thanks for your response. I have realized that the bug is due to that I set the map object defined in this user control (_Map) as the parent one: _Map = _Parent.MyMap; Then, the layer defined in the user control becomes un-recognized: GraphicsLayer graphicsLayer = _Map.Layers["MyGraphicsLayer"] as GraphicsLayer; I re-coded and then the problem got solved. Thanks and have a nice day! Yours, Shaning
... View more
10-22-2010
05:20 AM
|
0
|
0
|
511
|
|
POST
|
Scenario description 1) Create a UserControls file by loading the ClosedFacility component from ESRI: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ClosestFacility 2) Add some code in MainPage.xaml and MainPage.xaml.cs to load the ClosedFacility dialog when it is needed. Also set this component's _Map the same as the parent's (MainPage defined): MyClosedFacility.SetParent(this); MyClosedFacility.SetMap(MyMap); However, when the dialog pops out, all of the buttons (except for the Clear button) are greyed out. Thus, no featurs (points, lines or polygons) can be added. I don't know why those buttons are greyed-out. I appreciate if you can provide your hint. Thanks.
... View more
10-21-2010
10:56 AM
|
0
|
3
|
938
|
|
POST
|
I used ESRI's source code: Drive Time from http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#DriveTimes, and then have some customizations. In the xaml file, the GraphicsLayer is defined and named as 'MyGraphicsLayer': <esri:Map x:Name="_Map" Background="White" Extent="-122.5009,37.741,-122.3721,37.8089 <esri:GraphicsLayer ID="MyGraphicsLayer"> In the .cs file, private void _Map_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e) { _geoprocessorTask.CancelAsync(); GraphicsLayer graphicsLayer = _Map.Layers["MyGraphicsLayer"] as GraphicsLayer; Graphic graphic = new Graphic() { Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as Symbol, Geometry = e.MapPoint, }; graphic.Attributes.Add("Info", "Start location"); string latlon = String.Format("{0}, {1}", e.MapPoint.X, e.MapPoint.Y); graphic.Attributes.Add("LatLon", latlon); graphic.SetZIndex(1); graphicsLayer.Graphics.Add(graphic); .... I received an exception for graphicsLayer that is null. In this piece of code, the graphicsLayer has been defined as 'MyGraphicsLayer' and should not be null per my understanding. If you can find the bug and post your fidning, I will greatly appreciate. Have a nice day!
... View more
10-21-2010
08:41 AM
|
0
|
2
|
875
|
|
POST
|
Jenniffer: after commenting out //_Map.MouseClick += _Map_MouseClick; in the constructor, the user control dialog displays on the MainPage.xaml. Many thanks to you for your many times of quick and effective help. Shaning
... View more
10-20-2010
10:52 AM
|
0
|
0
|
836
|
|
POST
|
Actually, in all of the classes (including the MainPage.xaml), the namespace is defined: xmlns:local="clr-namespace:UnBlendedCS1_Oct1" For example, it is OK for <local:AddressLocator x:Name="MyAddressLocator" Visibility="Collapsed" Height="300" Width="300" Canvas.Left="278" Canvas.Top="242" /> but not for <local:DriveTime x:Name="MyDriveTime" Visibility="Collapsed" Height="110" Width="250" Canvas.Left="18" Canvas.Top="310" />
... View more
10-20-2010
07:13 AM
|
0
|
0
|
836
|
|
POST
|
Jenniffer: Thanks for your response. I found that the problem was that I did add the graphics layer onto the map. No the problem has been solved. Thanks again. Shaning
... View more
10-20-2010
06:59 AM
|
0
|
0
|
773
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-18-2023 10:02 AM | |
| 3 | 07-14-2023 12:29 PM | |
| 1 | 04-02-2021 12:16 PM | |
| 1 | 07-24-2017 11:31 AM | |
| 1 | 04-04-2016 03:59 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-01-2025
11:58 AM
|