The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Popup.Child Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the content to be hosted in the popup.

Namespace:  System.Windows.Controls.Primitives
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

Public Property Child As UIElement
<Popup ...>

XAML Values


A single object element that the popup displays as content. This child must be an object that derives from UIElement.

Property Value

Type: System.Windows.UIElement
The content to be hosted in the popup.

Dependency property identifier field: ChildProperty

The Child property can be any single UIElement. In order to host multiple items, create a UserControl or host the content in a container, such as StackPanel or Grid. A popup will always appear on top of existing content, including other popup controls.

Child is the XAML content property for Popup, so you do not need to specify a Popup.Child property element in the XAML syntax. For more information about XAML content property syntax, see XAML for Windows Phone 8.

The following example shows how to use a Popup to display a border that contains a text block and a button. The popup content is created inline for conciseness, but you would typically create this content in a separate user control and use an instance of that control as the child of the popup.

' Create the popup object. 
Private p As New Popup()
Private Sub showPopup_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    ' Create some content to show in the popup. Typically you would 
    ' create a user control. 
    Dim border As New Border()
    border.BorderBrush = New SolidColorBrush(Colors.Black)
    border.BorderThickness = New Thickness(5)

    Dim panel1 As New StackPanel()
    panel1.Background = New SolidColorBrush(Colors.LightGray)

    Dim button1 As New Button()
    button1.Content = "Close"
    button1.Margin = New Thickness(5)
    AddHandler button1.Click, AddressOf button1_Click
    Dim textblock1 As New TextBlock()
    textblock1.Text = "The popup control"
    textblock1.Margin = New Thickness(5)
    border.Child = panel1

    ' Set the Child property of Popup to the border 
    ' which contains a stackpanel, textblock and button. 
    p.Child = border

    ' Set where the popup will show up on the screen. 
    p.VerticalOffset = 150
    p.HorizontalOffset = 150

    ' Open the popup. 
    p.IsOpen = True

End Sub

Private Sub button1_Click(ByVal sender As Object, _
    ByVal e As RoutedEventArgs)
    ' Close the popup. 
    p.IsOpen = False

End Sub

<phone:PhoneApplicationPage x:Class="Popup2.Page"
    FontFamily="Trebuchet MS" FontSize="11" mc:Ignorable="d" xmlns:d="" xmlns:mc="" d:DesignHeight="800" d:DesignWidth="480">

        <StackPanel x:Name="LayoutRoot" Background="Transparent">
            <Button x:Name="showPopup" 
            Click="showPopup_Click" Content="Show Popup" />

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone