Select to view content in your preferred language

How to display Image Element

524
2
05-26-2010 11:27 PM
hunterruan
New Contributor
I have a problem to show display a Image on the map. There are one Button and one Image on the map, the visibility of the Image is Collapsed and when the Button is clicked, the visibility of the image will be changed to Visible. But the Image doesn't display on the map, anyone can explain this?

xaml code:
<esri:Map x:Name="LocalMap" >
            <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="Fill" Visibility="Collapsed" 
                           esri:ElementLayer.Envelope="0,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"></Image>

                </esri:ElementLayer.Children>
            </esri:ElementLayer>
        </esri:Map>


cs code:
 private void RedlandsButton_Click(object sender, RoutedEventArgs e)
        {
            Image image = (LocalMap.Layers["MyElements"] as ElementLayer).Children[1] as Image;
            image.Visibility = Visibility.Visible;
        }
0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor
Does it display if you start up with it visible?
0 Kudos
hunterruan
New Contributor
Thanks for your reply.

The Image displays if I start up with visible.

And it's eary for you to do a test to reproduce this case. Hope for other replies.
0 Kudos