Hi,I am trying to add a zoom-to individual layers inside a map service. In my Legend template, I added an image to represent the zoom action and I wanted to add an event trigger that would automatically zoom to the extent of that layer. Something like:
<Image Source="images/zoom.png">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:ZoomToAction TargetName="Map">
<esri:ZoomToAction.Geometry>
Use some binding here to get the envelope
</esri:ZoomToAction.Geometry>
</esri:ZoomToAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Image>
But, when I try to add this, I get a message saying "A value of type 'ZoomToAction' cannot be added to a collection or dictionary of type 'TriggerActionCollection'." Can't I do this? There is something similar done in the online samples that zoom-to a hardcoded envelope. Here is the code that is used:
<Button Style="{StaticResource MenuItem}"
Content="Zoom To" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:ZoomToAction
TargetName="MyMap">
<esri:ZoomToAction.Geometry>
<esri:Envelope XMin="-14930991.170" YMin="3611744.037" XMax="-11348896.882" YMax="5340571.181" />
</esri:ZoomToAction.Geometry>
</esri:ZoomToAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
There is another sample that zooms to a service layer.
<Button Style="{StaticResource MenuItem}"
Content="Zoom To Layer" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<esri:ZoomToLayerAction
LayerID="MyFeatureLayer"
TargetName="MyMap" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
I am using the Legend control in the 2.1 API.Paul