WPF Popup problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • furqanms
    New Member
    • Jun 2007
    • 17

    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.
    [code=xml]
    <!-- Middle Product List -->
    <GroupBox Grid.Column="1" Grid.Row="2">
    <ScrollViewer VerticalScrollB arVisibility="D isabled" HorizontalScrol lBarVisibility= "Disabled">
    <ListBox Style="{Dynamic Resource PhotoListBoxSty le}"
    Name ="PhotoListB ox"
    Margin="5"
    SelectionMode=" Single"
    ItemsSource="{B inding}"
    HorizontalAlign ment="Center"
    VerticalAlignme nt="Center"
    SelectedIndex=" 0"

    >
    <ListBox.ItemTe mplate>
    <!--<DataTemplate >
    <Image Source="{Bindin g Path=ProductIma gePath}" />
    </DataTemplate>-->

    <DataTemplate >
    <Grid VerticalAlignme nt="Center" HorizontalAlign ment="Center" Margin="6">
    <!-- Drop Shadow -->
    <Border HorizontalAlign ment="Stretch" VerticalAlignme nt="Stretch" CornerRadius="4 " Background="#44 000000">
    <Border.RenderT ransform>
    <TranslateTrans form X="5" Y="5" />
    </Border.RenderTr ansform>
    <Border.BitmapE ffect>
    <BlurBitmapEffe ct Radius="8" />
    </Border.BitmapEf fect>
    </Border>
    <!-- Image Template -->
    <Border Padding="4" Background="Whi te" BorderBrush="#2 2000000" BorderThickness ="1">
    <StackPanel Orientation="Ve rtical">
    <Image Height="150" Width="100" Source="{Bindin g Path=ProductIma gePath}"/>
    <!--<Label Content="{Bindi ng Metadata.DateIm ageTaken}">
    <Label.ToolTi p>
    Only JPeg images with a stored thumbnail will display a thumbnail during preview.
    </Label.ToolTip>
    </Label>-->
    </StackPanel>
    </Border>
    </Grid>
    </DataTemplate>

    </ListBox.ItemTem plate>

    <ListBoxItem HorizontalConte ntAlignment="St retch" Background="Blu e"></ListBoxItem>
    <ListBoxItem HorizontalConte ntAlignment="St retch" Background="Blu e" Name="ListBoxIt em1">Click Me</ListBoxItem>
    <ListBoxItem HorizontalConte ntAlignment="St retch" Background="Blu e"></ListBoxItem>
    </ListBox>
    </ScrollViewer>
    </GroupBox>


    <!-- Pop-Up Product Information Window -->
    <Popup Name="ProductIn fo"
    StaysOpen="Fals e"
    Placement="Cent er"
    MaxWidth="200"
    PopupAnimation= "Slide"
    AllowsTranspare ncy = "False">

    <Border BorderBrush="Be ige"
    BorderThickness ="2"
    Background="Whi te">


    <TextBlock Name="abc" Margin="10"
    TextWrapping="W rap" >
    For more information, see
    </TextBlock>

    </Border>
    </Popup>
    <!-- Pop-Up Product Information Window -->
    [/code]
    This is a code behind
    [code=vbnet]
    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)).Nav igateUri.ToStri ng())
    End Sub

    Private Sub ListBoxItem1_Se lected(ByVal sender As System.Object, ByVal e As System.Windows. RoutedEventArgs ) Handles ListBoxItem1.Se lected
    popLink.IsOpen = True
    End Sub
    End Class

    [/code]
    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 Frinavale; Dec 2 '08, 08:52 PM. Reason: added [code] tags
Working...