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"
-
Margin="5"
-
SelectionMode="Single"
-
ItemsSource="{Binding}"
-
HorizontalAlignment="Center"
-
VerticalAlignment="Center"
-
SelectedIndex="0"
-
-
>
-
<ListBox.ItemTemplate>
-
<!--<DataTemplate>
-
<Image Source="{Binding Path=ProductImagePath}" />
-
</DataTemplate>-->
-
-
<DataTemplate >
-
<Grid VerticalAlignment="Center" HorizontalAlignment="Center" Margin="6">
-
<!-- Drop Shadow -->
-
<Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4" Background="#44000000">
-
<Border.RenderTransform>
-
<TranslateTransform X="5" Y="5" />
-
</Border.RenderTransform>
-
<Border.BitmapEffect>
-
<BlurBitmapEffect Radius="8" />
-
</Border.BitmapEffect>
-
</Border>
-
<!-- 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}">
-
<Label.ToolTip>
-
Only JPeg images with a stored thumbnail will display a thumbnail during preview.
-
</Label.ToolTip>
-
</Label>-->
-
</StackPanel>
-
</Border>
-
</Grid>
-
</DataTemplate>
-
-
</ListBox.ItemTemplate>
-
-
<ListBoxItem HorizontalContentAlignment="Stretch" Background="Blue"></ListBoxItem>
-
<ListBoxItem HorizontalContentAlignment="Stretch" Background="Blue" Name="ListBoxItem1">Click Me</ListBoxItem>
-
<ListBoxItem HorizontalContentAlignment="Stretch" Background="Blue"></ListBoxItem>
-
</ListBox>
-
</ScrollViewer>
-
</GroupBox>
-
-
-
<!-- Pop-Up Product Information Window -->
-
<Popup Name="ProductInfo"
-
StaysOpen="False"
-
Placement="Center"
-
MaxWidth="200"
-
PopupAnimation="Slide"
-
AllowsTransparency = "False">
-
-
<Border BorderBrush="Beige"
-
BorderThickness="2"
-
Background="White">
-
-
-
<TextBlock Name="abc" Margin="10"
-
TextWrapping="Wrap" >
-
For more information, see
-
</TextBlock>
-
-
</Border>
-
</Popup>
-
<!-- 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