Please see the following code:xaml code:
<esri:ArcGISTiledMapServiceLayer ID="MyLayer"
Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
<esri:ElementLayer ID="MyElements">
<esri:ElementLayer.Children>
<Button x:Name="RedlandsButton" Width="100" Height="20" Content="ShowImage"
esri:ElementLayer.Envelope="-10,10,-10,10" Click="RedlandsButton_Click"
VerticalAlignment="Center" HorizontalAlignment="Center" ToolTipService.ToolTip="help"
>
</Button>
<Image x:Name="Pic" Source="../pin_red.png" Stretch="None"
esri:ElementLayer.Envelope="0,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"></Image>
<Image x:Name="HoldPic" Source="../pin_red.png" Stretch="Fill" Visibility="Collapsed"
esri:ElementLayer.Envelope="0,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"></Image>
</esri:ElementLayer.Children>
</esri:ElementLayer>
</esri:Map>
cs code:
public ElementVisibilityWithMapExtent()
{
InitializeComponent();
LocalMap.Extent = new Envelope(-20,-20,20,20);
}
private void RedlandsButton_Click(object sender, RoutedEventArgs e)
{
Image image = (LocalMap.Layers["MyElements"] as ElementLayer).Children[1] as Image;
image.Visibility = Visibility.Visible;
ElementLayer.SetEnvelope(image,new Envelope(-30,30,-30,30));
//This extent is availble for the map to show the image
//LocalMap.ZoomTo(new Envelope(-103.0947, -41.07186, 58.95613, 68.22523));
LocalMap.ZoomTo(new Envelope(-103.0947, 21.07186, 58.95613, 68.22523));
}
After clicking the Button, the extent of the map is changed but the Image doesn't display on the map.How can I show the Image successfully?