WPF アプリケーションに Flyoout ポップアップ ウィンドウとテスト ウィンドウがあります。必要なのは、フライアウトの外側をクリックしたときにウィンドウを閉じる必要があるということです。Panel.Zindex を上に見えるように設定しました。正常に動作するコードを試しました。しかし、フライアウトの内側をクリックしたのか、フライアウト ウィンドウの外側をクリックしたのかわかりません。メイン画面内をクリックすると閉じます。
ここに私のxamlコードがあります:
xmlns:metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
<metro:Flyout x:Name="flyOutControl" IsOpen="False" Background="#5D7BA5" Foreground="White"
Grid.Row="0" Grid.RowSpan="4" Grid.Column="0" Grid.ColumnSpan="2" Panel.ZIndex="50"
Width="400" Height="auto">
<TreeView x:Name="treeviewBreadcrumb" Width="350"
HorizontalAlignment="Left" FontSize="20"
Background="Transparent" Foreground="White"
VerticalAlignment="Top">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
</metro:Flyout>
If i am in Test window screen, I can set a Isopen property to true this Flyout. how can i close this if i click outside of any other window?
Any help would be really appriciated.. Thanks in advance..