這裏是XAML
打開彈出窗口的代碼IsChecked btnViewDetail,我需要關閉彈出窗口的彈出側。如何關閉彈出窗口當我在彈出窗口外單擊
<Popup IsOpen="{Binding IsChecked, ElementName=btnViewDetail}" PopupAnimation="Fade" Width="300" Height="225" PlacementTarget="{Binding ElementName=svTotalStock}" Placement="Top" StaysOpen="False">
<Grid Background="Black">
<TextBlock TextWrapping="Wrap" Text="Raw Materials details"
VerticalAlignment="Top" Height="25" FontFamily="Segoe UI Semibold"
Padding="7,6,0,0" FontWeight="Bold" FontSize="14" Foreground="White"
Margin="0,2,59,0"/>
<Border BorderThickness="1" BorderBrush="Black"/>
</Grid>
</Popup>
<Grid>
<Grid.ContextMenu>
<ContextMenu>
<MenuItem IsCheckable="True" Name="btnViewDetail" Header="View Details"/>
</ContextMenu>
</Grid.ContextMenu>
</Grid>
我想知道爲什麼'StaysOpen =「False」'不起作用? – Tyress
注意用戶控制時StaysOpen =「False」正常工作。 – Sam