Popup Example in WPF

This blog defines how to use Popup Control in WPF.

<Window x:Class="LayoutDemo.wndPopup"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="wndPopup" Height="300" Width="300">

  <Grid>

    <ToggleButton IsChecked="{Binding ElementName=pup, Path=IsOpen}" Content="Open Popup" Margin="100" />

    <Popup Placement="Bottom" AllowsTransparency="True"  PopupAnimation="Fade" x:Name="pup" VerticalOffset="-100">

      <StackPanel>

        <TextBlock Name="McTextBlock" Background="Black" Foreground="White" >

          This is popup text

        </TextBlock>

        <Button Content="Close this Pupup" Click="Button_Click"/>

      </StackPanel>

    </Popup>

  </Grid>

</Window>