PopUp WPF in VB.NET

This article shows how to create and use a Popup control available in WPF and XAML.
  • 3972

This article shows how to create and use a Popup control available in WPF and XAML.

PopUp control

That is a small pop up window displaying some information appears at the right lower corner of the screen just like what Live Messenger does is more friendly to the user.

The Popup tag represents a WPF Popup control in XAML.

 <Popup></Popup>

 

Important property

 

The Width and Height properties represent the width and the height of a Popup.

 

The Name property represents the name of the control, which is a unique identifier of a control.

 

The Margin property tells the location of a Popup on the parent control.

 

The HorizontalAlignment and VerticalAlignment properties are used to set horizontal and vertical alignments.

 

For example

 

XAML code

 

<Window x:Class="MainWindow"

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

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

    Title="MainWindow" Height="350" Width="525">

    <Grid>    

        <Popup Margin="21,74,0,0" Name="Popup1" HorizontalAlignment="Left" Width="352" IsOpen="True" Height="225" VerticalAlignment="Top">

            <StackPanel >

             <TextBlock Name="McTextBlock"

             Background="LightBlue" >

            This is popup text

            </TextBlock><TextBox  Text ="This ia a Textbox on a Pupup" />

            <Rectangle Height="100" HorizontalAlignment="Left" Margin="32,109,0,0" Name="Rectangle1" Stroke="Black" VerticalAlignment="Top" Width="169" Fill="Aquamarine" />

            </StackPanel>

            </Popup>

    </Grid>

</Window>

 

Now run the application.

 

pop1.gif

Figure1.gif

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.