彼はみんな!
私がやりたいことは、(ViewModel のコレクションにバインドされた) アイテムのリストを含むフライアウトを開き、ユーザーがリスト内のアイテムを選択すると、フライアウトが非表示になるようにすることです。これを実現するために、フライアウトを非表示にする動作を使用しています。問題は、既に選択されているアイテム (現在選択されているアイテム) をタップすると、動作が機能しないことです。
次のコードがあります。
<Button.Flyout>
<Flyout Placement="Full">
<interactivity:Interaction.Behaviors>
<core:DataTriggerBehavior Binding="{Binding SelectedCategory}"
ComparisonCondition="NotEqual">
<controls:CloseFlyoutAction />
</core:DataTriggerBehavior>
</interactivity:Interaction.Behaviors>
<ListView ItemsSource="{Binding Source={StaticResource GroupedCategories}}"
SelectedItem="{Binding SelectedCategory, Mode=TwoWay}">
<ListView.GroupStyle>
<GroupStyle>
//... skiped for brevity
</GroupStyle>
</ListView.GroupStyle>
<ListView.ItemTemplate>
<DataTemplate>
<ContentControl Foreground="{Binding IsSelected, Converter={StaticResource ForegroundConverter}}"
Content="{Binding Name}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Flyout>
</Button.Flyout>