Can i use child window control to show map legend or overview? I tried to use the child window control to show map legend but i couldn't make it work. Is there any way to use the child window control in ArcGIS Silverlight projects?


The child window control works like a modal dialog, or popup for your Silverlight application. When the child window appears, it sits on top of the parent window and stops you from doing anything to the parent window until you accept or close the child window.

The child window is useful to show display disclaimer information about the map, collect form data, or anything that you would use to interrupt the use of the map. Legend and overview could be done with this, but it's not recommended. They would be better suited to be placed directly on the map.

But if you're still interested, here's how to implement the legend using the child window.


<controls:ChildWindow x:Class="myProject.PopupLegend"
       Width="400" Height="300"
        <Grid x:Name="LayoutRoot" Margin="2">
            <RowDefinition />
            <RowDefinition Height="Auto" />
        <esri:Legend x:Name="MyPopupLegend" Grid.Row="0" />
        <Button x:Name="CancelButton" Content="Cancel" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
        <Button x:Name="OKButton" Content="OK" Width="75" Height="23" HorizontalAlignment="Right"  Margin="0,12,79,0" Grid.Row="1" />

Code Behind (VB.NET)

Partial Public Class PopupLegend
    Inherits ChildWindow

    Public Sub New(ByVal map As ESRI.ArcGIS.Client.Map)
        Me.MyPopupLegend.Map = map
    End Sub

    Private Sub OKButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles OKButton.Click
        Me.DialogResult = True
    End Sub

    Private Sub CancelButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles CancelButton.Click
        Me.DialogResult = False
    End Sub

End Class

And to call it up:

Dim popup = New PopupLegend(MyMap)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.