ARTICLE

WPF PopUp in VB.NET

Posted by Micalgray Articles | XAML in VB.NET March 16, 2011
This article shows how to create and use a Popup control available in WPF and XAML.
 
Reader Level:

HTML clipboard

HTML clipboard

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

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Team Foundation Server Hosting
Become a Sponsor