#874 – Setting the Background for a Popup

You must explicitly set the Background for the controls hosted within a Popup control.  The Popup does not inherit the background brush of any parent element (e.g. a parent Window).

You typically set the Background property for the single element hosted within the Popup (e.g. a Border element).  If you don’t specify a value for the Background, the behavior depends on the value of the Popup’s AllowTransparency property:

  • If AllowTransparency is false, the background of the popup will be black
  • If AllowTransparency is true, the popup will be transparent


Below is an example where the Background is set for the Border element contained within the Popup.

        <Popup Name="popCaesar" StaysOpen="False"
            <Border BorderBrush="Blue" BorderThickness="1"
                <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"
                            Width="150" TextWrapping="Wrap"/>



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

One Response to #874 – Setting the Background for a Popup

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

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: