WPF Popup Problem

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: WPF Popup Problem

Hybrid View

  1. #1
    Join Date
    Nov 2006

    WPF Popup Problem

    I have a little problem in a XAML application. When I use a popup in a
    WPF application, I am not able to get rid of the popup from the view
    even if I do Alt-Tab to move focus to other applications.

    Even I have set stayopen=false

    Following is the code which I have done.
     <!-- Middle Product List --> 
            <GroupBox Grid.Column="1" Grid.Row="2"> 
                <ScrollViewer VerticalScrollBarVisibility="Disabled"  HorizontalScrollBarVisibility="Disabled"> 
                    <ListBox Style="{DynamicResource PhotoListBoxStyle}"  
                    Name ="PhotoListBox"  
                        <Image Source="{Binding Path=ProductImagePath}" /> 
                            <DataTemplate > 
                                <Grid VerticalAlignment="Center" HorizontalAlignment="Center" Margin="6"> 
                                    <!-- Drop Shadow --> 
                                    <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4" Background="#44000000"> 
                                            <TranslateTransform X="5" Y="5" /> 
                                            <BlurBitmapEffect Radius="8" /> 
                                    <!-- Image Template --> 
                                    <Border Padding="4" Background="White" BorderBrush="#22000000" BorderThickness="1"> 
                                        <StackPanel Orientation="Vertical"> 
                                            <Image Height="150" Width="100" Source="{Binding Path=ProductImagePath}"/> 
                                            <!--<Label Content="{Binding Metadata.DateImageTaken}"> 
                                                    Only JPeg images with a stored thumbnail will display a thumbnail during preview. 
                        <ListBoxItem HorizontalContentAlignment="Stretch"  Background="Blue"></ListBoxItem> 
                        <ListBoxItem HorizontalContentAlignment="Stretch" Background="Blue" Name="ListBoxItem1">Click Me</ListBoxItem> 
                        <ListBoxItem HorizontalContentAlignment="Stretch" Background="Blue"></ListBoxItem> 
     <!-- Pop-Up Product Information Window --> 
            <Popup Name="ProductInfo"  
                       AllowsTransparency = "False"> 
                <Border BorderBrush="Beige"  
                    <TextBlock Name="abc" Margin="10"   
                                           TextWrapping="Wrap" >  
                                    For more information, see 
            <!-- Pop-Up Product Information Window -->
    This is a code behind
    Public Class PopupTest 
        Private Sub run_MouseEnter(ByVal sender As Object, ByVal e As MouseEventArgs) 
            popLink.IsOpen = True 
        End Sub 
        Private Sub lnk_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) 
            Process.Start((CType(sender, Hyperlink)).NavigateUri.ToString()) 
        End Sub 
        Private Sub ListBoxItem1_Selected(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ListBoxItem1.Selected 
            popLink.IsOpen = True 
        End Sub 
    End Class
    case 1 : When I clicked on the term, it will popup and disapear when I clicked outside anywhere
    Case 2 : I have listbox and have a list item named "click me" , when I clicked on this list item the popup will appear but when I click outside anywhere it is not going to be disapear.

    Please help me to solve this problem

    Thanking you in advanced
    Last edited by Hack; 12-02-2008 at 07:21 AM. Reason: Added Code Tags

  2. #2
    Join Date
    Jan 2009
    I have run into the same issue where the Popup will not disappear when the IsOpen property is set to True in the LisBoxItem's Selected event handler. I do not understand why this is the case, although I have not looked deeply into it.

    Regardless, it looks like you found a workaround here:

    There may also be a solution to the problem that does not need to make use of Popups, but that's for you to decide given your particular scenario.
    Last edited by gurge60; 03-25-2009 at 06:14 PM.

Similar Threads

  1. a very weird problem (AGAIN!!!)
    By Michael in forum ASP.NET
    Replies: 14
    Last Post: 02-24-2006, 08:54 AM
  2. Close popup window and reload parent form
    By ankushbindra in forum ASP.NET
    Replies: 1
    Last Post: 11-28-2005, 03:50 PM
  3. Replies: 3
    Last Post: 11-16-2005, 06:15 PM
  4. Reliability Problem
    By elise in forum Java
    Replies: 0
    Last Post: 10-30-2002, 04:40 AM
  5. Replies: 0
    Last Post: 06-23-2000, 02:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center