Create PopUp Window in C# WPF

To create PopUp window WPF provide a popup tag.when i click a button then the pop-up window is open.This pop-up window contain a listview.The pop-up window is closed when leaving the mouse from other place.
Here is the code for creation pop-up window

<Popup Name="PopupEsales" Placement="Right" IsEnabled="True" IsOpen="False" Grid.RowSpan="2">
    <ListView Height="145" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="lvSalesPersonIdSearch" VerticalAlignment="Top" Width="257" SelectionChanged="lvSalesPersonIdSearch_SelectionChanged">
                <GridViewColumn Header="Sales Persons Id" Width="100" DisplayMemberBinding="{Binding Path=SPID}" />
                <GridViewColumn Header="Name" Width="100" DisplayMemberBinding="{Binding Path=Name}" />

This following code under the button to open the pop-up window

private void btnSearchInfo_Click(object sender, RoutedEventArgs e)
        PopupEsales.IsOpen = true;

Pop-Up Close

        private void LayoutRoot_MouseLeave(object sender,MouseEventArgs e)
            PopupEsales.StaysOpen = false;

If you have any query about this topic please leave a comment.


2 Responses to “Create PopUp Window in C# WPF”

  1. ayanahmed Says:

    thanks Mr. Refat38 it’s a too much helpful blog for me.

  2. Towhid Says:

    Thanks for sharing.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google 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: