|
POST
|
Oh I think I get what you are talking about now. You are looking for an event that will fire when the command is no longer active. EditorActivated only fires when you activate a command and EditCompleted event only fires when you have successfully executed the command. For the case when you try to make a selection on an area without graphics, no selection is made, the command did not execute successfully so EditCompleted is not raised. I'm afraid that using only these two events cannot get you what you wanted. Jennifer
... View more
08-10-2010
07:59 PM
|
0
|
0
|
1264
|
|
POST
|
Hi Stephen, When you access the URL via browser for the first time after it has been idle, do you get the same error as when use SL/WPF API? If not, you can listen to the layer's InitalizedFailed event. This is probably where the exception is thrown and you can do what you need to do inside this event handler to maybe try to Initialize again. It might also be a good idea to look at the web requests/responses using Fiddler so we can narrow down where it is failing based on the sequence of events. Jennifer
... View more
08-10-2010
07:33 PM
|
0
|
0
|
1611
|
|
POST
|
Which version of ArcGIS API for Microsoft Silverlight/WPF are you using? 1.2 or 2.0? Jennifer
... View more
08-10-2010
05:43 PM
|
0
|
0
|
1742
|
|
POST
|
If you only want to know when the Editor is activated, you can listen to the EditorActivated event. But if you need to know which command is currently active, you cannot get this information from this event. You can investigate what properties and methods are available in the Editor. Currently, there is no property to tell you which command will begin to execute when this event is fired. This is why I suggested, using Click events. Because what really goes on here is first user will click on the button, EditorActivated event is fired, and the command for that button gets executed; so on click event you know which command user has just activated. This is just a proposed workaround. I am a little bit confused with this one, can you clarify what you mean? I can't believe that the editor turns off just because the user clicks somewhere other than the selectable layer, and on the flip side, if they want to turn off the selection process they have to click somewhere other than this layer. Do you have something like this, where each of the button's click event is wired up to the Button_Click? You can replace the code that goes in these event handlers. This is just to show the simple case where you want to highlight the active button.
public MainPage()
{
InitializeComponent();
editor = this.LayoutRoot.Resources["MyEditor"] as Editor;
if (editor != null)
editor.EditCompleted += new EventHandler<Editor.EditEventArgs>(editor_EditCompleted);
}
Editor editor;
void editor_EditCompleted(object sender, Editor.EditEventArgs e)
{
if (editor.ContinuousMode) return;
foreach (var edits in e.Edits)
{
if (e.Action == Editor.EditAction.Select)
ResetButtonHighlights();
}
}
private void ResetButtonHighlights()
{
SelectButton.Background = new SolidColorBrush(Colors.LightGray);
AddSelectButton.Background = new SolidColorBrush(Colors.LightGray);
RemoveSelectButton.Background = new SolidColorBrush(Colors.LightGray);
ClearSelectionButton.Background = new SolidColorBrush(Colors.LightGray);
EnableKeyboardButton.Background = new SolidColorBrush(Colors.LightGray);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (!editor.ContinuousMode)
ResetButtonHighlights();
Button b = sender as Button;
b.Background = new SolidColorBrush(Colors.Yellow);
}
Jennifer
... View more
08-10-2010
04:00 PM
|
0
|
0
|
1264
|
|
POST
|
In that case you will need a two-way Element Binding and for path, pass in the layer's Opacity. (see code below for sample).
<esri:Map x:Name="MyMap">
<esri:ArcGISTiledMapServiceLayer Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
<esri:FeatureLayer ID="HomelandSecurity"
Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/LandusePlanning/FeatureServer/0"/>
</esri:Map>
<Slider x:Name="MySlider"
VerticalAlignment="Top"
Minimum="0"
Maximum="1"
Value="{Binding ElementName=MyMap, Path=Layers[HomelandSecurity].Opacity, Mode=TwoWay}" />
Jennifer
... View more
08-10-2010
03:06 PM
|
0
|
0
|
667
|
|
POST
|
The DataContext you retrieved from the EditorWidget is correct too. This is the Editor that acts on the toolbar so if you wish to check that EditGeometry/Select/Cut/Reshape/Union were performed, you will use the Editor from the widget. The other sets of Editors come from the TemplatePicker. You can use this if you wish to monitor the Add. The attached XAML code was produced by Expression Blend. You can apply this style to your EditorWidget, it is the DefaultStyle - I only added handler for TemplatePicker's Loaded event. In the code-behind you can do the following:
private void TemplatePicker_Loaded(object sender, RoutedEventArgs e)
{
TemplatePicker picker = sender as TemplatePicker;
foreach (var t in picker.Templates)
{
t.Editor.EditCompleted += new EventHandler<Editor.EditEventArgs>(Editor_EditCompleted);
}
}
You can use the same event handler as the Editor from the widget so all are checked in one place. I'm sorry if I was unclear with my previous posts. I thought you had ExpressionBlend. Jennifer
... View more
08-10-2010
07:12 AM
|
0
|
0
|
853
|
|
POST
|
The RampInterpolator also includes SizeRange, which has From and To values. You can add this with your ColorRange if you wanted to interpolate symbols in both size and color. If your layer is Time-Aware, you can use the TimeSlider and bind its value to the layer's TimeExtent, like in this example:http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#TimeSliderFeatureLayer Jennifer
... View more
08-10-2010
06:28 AM
|
0
|
0
|
388
|
|
POST
|
I believe Method not found exception occurs when the assemblies included are not the same assemblies the project was built in. Why it worked on your machine and not on your colleague's or server, probably means you had the correct path for the assemblies and built the solution with them, but they didn't have access to these assemblies or was not able to rebuild the solution with them. For the machines that threw this exception, have you tried to Clean the solution, check that the referenced assemblies are the correct ones and then rebuild solution again? Are there any file access issue to these assemblies? If you go to the file properties of the DLL's, do you see "Unblock" button? Are all referenced assemblies the same in comparison to your machine and theirs? Jennifer
... View more
08-09-2010
09:11 PM
|
0
|
0
|
469
|
|
POST
|
The EditorWidget is most useful for editable FeatureLayers because you may use TemplatePicker and other buttons with it. So if the only geometry service you would like to use is for Edit Geometry, it might be better idea to use a single button "Edit Geometry" (see this sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave If you are working with a GraphicsLayer and you know which graphic you will be editing, say you listen to a MouseLeftButtonDown event, you can update the button's CommandParameter and pass this graphic. Jennifer
... View more
08-09-2010
06:53 AM
|
0
|
0
|
320
|
|
POST
|
The Editor from the EditorWidget, acts on the toolbar. The EditorWidget contains a TemplatePicker. If you have Expression Blend, you can see what UIElements are contained in the widget by adding an EditorWidget to an empty SL application, right-click on the widget and "Edit Template". You will find that just as in this example, the buttons contained in the widget are made active through an Editor:http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave Jennifer
... View more
08-09-2010
06:46 AM
|
0
|
0
|
853
|
|
POST
|
Do you mean this? http://msdn.microsoft.com/en-us/library/cc903962(VS.95).aspx
... View more
08-08-2010
10:26 PM
|
0
|
0
|
901
|
|
POST
|
What error message do you get? Are you able to visit your map service through the browser? When you run your SL app using your map service, run Fiddler too (like Dominique suggested). This will help you understand how the web requests are being handled. Jennifer
... View more
08-08-2010
10:18 PM
|
0
|
0
|
553
|
|
POST
|
I know this is not an elegant solution but it is a workaround if you really would like to change the appearance of your button. While the buttons' Command help determine if its state will be enabled, it does not detect when it is active. The Editor will know which command is active but it this is not made public. The EditCompleted event will help you decide which active button to turn off once it's complete. Using that specific example, you can do the following. Listen to EditCompleted. This will be useful for removing highlight on the active button.
<esri:Editor x:Key="MyEditor"
Map="{Binding ElementName=MyMap}"
LayerIDs="CensusDemographics"
SelectionMode="Rectangle"
ContinuousMode="True"
EditCompleted="Editor_EditCompleted"/>
and for each button, listen to Button_Click. This will be useful for adding highlight to the active button and removing highlight to the other buttons if Editor is ContinuousMode. Do this for each of the buttons.
<Button x:Name="SelectButton"
Margin="2"
Content="New"
Command="{Binding Select}"
CommandParameter="New"
Click="SelectButton_Click"
></Button>
In the code-behind, you can do something like this.
private void Editor_EditCompleted(object sender, Editor.EditEventArgs e)
{
Editor editor = sender as Editor;
if (editor.ContinuousMode) return; // for this case, remove highlight when other button is clicked.
foreach (var edits in e.Edits)
{
if (e.Action == Editor.EditAction.Select)
{
SelectButton.Background = new SolidColorBrush(Colors.LightGray);
}
}
}
private void SelectButton_Click(object sender, RoutedEventArgs e)
{
//if Editor is Continuous, remove highlight on other buttons before this code
Button b = sender as Button;
b.Background = new SolidColorBrush(Colors.Yellow);
}
I hope this helps. Jennifer
... View more
08-07-2010
10:23 AM
|
0
|
0
|
1264
|
|
POST
|
You can define your GraphicCollection in Xaml under UserControl.Resources as such:
<esri:GraphicCollection x:Key="MyGraphics" />
and then create the binding to Graphics this way:
<esri:GraphicsLayer ID="MyGraphicsLayer"
Graphics="{Binding Source={StaticResource MyGraphics}}">
Any changes to your GraphicCollection should affect the Graphics in your GraphicsLayer. Jennifer
... View more
08-07-2010
09:45 AM
|
0
|
0
|
439
|
|
POST
|
Tim Heuer at Microsoft posts a lot of good samples and tutorials. This one is specific to databinding: http://timheuer.com/blog/articles/silverlight-get-started-part-4-binding-data.aspx In your earlier question, I think you need to understand the syntax used in Binding. For example, when no Path property is defined, it must be implied so {Binding Visible, Mode=TwoWay} is the same as {Binding Path=Visible, Mode=TwoWay}. And when no ElementName property is defined, the DataContext is assumed to have already been set. So {Binding Visible, Mode=TwoWay}, means grab the Visible property of the Layer, since the ListBox is already bound to the Map's Layers. This is WPF DataBinding Cheat sheet, most of them apply to Silverlight so you might want to learn the syntax and when they are useful:http://www.nbdtech.com/Blog/archive/2009/02/02/wpf-xaml-data-binding-cheat-sheet.aspx Good luck! Jennifer
... View more
08-07-2010
09:10 AM
|
0
|
0
|
667
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-11-2025 01:30 PM | |
| 1 | 06-06-2025 10:14 AM | |
| 1 | 03-17-2025 09:47 AM | |
| 1 | 07-24-2024 07:32 AM | |
| 1 | 04-05-2024 06:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-03-2025
08:39 PM
|