#870 – Popup Is a ContentControl

The Popup control is a ContentControlwhich means that it can contain exactly one child control.  The child control can be any .NET object, but is often an instance of a Border, which in turn contains a single child element.  The single element in the Border could then be a container control deriving from Panel, which in turn contains multiple child controls.

For example, the code below shows a Popup whose child is a Border element which in turn contains a horizontally-oriented StackPanel that contains several other controls.

        <Popup Name="popCaesar" IsOpen="False">
            <Border BorderBrush="Blue" BorderThickness="1"
                Background="AliceBlue">
                <StackPanel Orientation="Horizontal">
                    <Image Source="Caesar.jpg" Height="100"/>
                    <TextBlock Text="Julius Caesar was a Roman emperor who lived from 100 BC to 44 BC"
                            Margin="10"
                            Width="150" TextWrapping="Wrap"/>
                </StackPanel>
            </Border>
        </Popup>

870-001

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

2 Responses to #870 – Popup Is a ContentControl

  1. Pingback: Dew Drop – July 24, 2013 (#1,591) | Alvin Ashcraft's Morning Dew

  2. Pingback: #871 – Popup Control Automatically Sizes to Fit Its Content | 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: