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"> <ListView.View> <GridView> <GridViewColumn Header="Sales Persons Id" Width="100" DisplayMemberBinding="{Binding Path=SPID}" /> <GridViewColumn Header="Name" Width="100" DisplayMemberBinding="{Binding Path=Name}" /> </GridView> </ListView.View> </ListView> </Popup>
This following code under the button to open the pop-up window
private void btnSearchInfo_Click(object sender, RoutedEventArgs e) { PopupEsales.IsOpen = true; lvSalesPersonIdSearch.Items.Add(aESales); }
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.
04/03/2011 at 4:56 AM
thanks Mr. Refat38 it’s a too much helpful blog for me.
04/03/2011 at 4:59 AM
Thanks for sharing.