#870 – Popup Is a ContentControl
July 24, 2013 2 Comments
The Popup control is a ContentControl, which 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>