He everybody!
What I want to do is to open a flyout with list of items (binded to a collection from a ViewModel) and then, when a user chooses any item in the list, the flyout should be hidden. To achieve this I'm using a behavior which hides the flyout. The problem is that the behavior doesn't work when I'm tapping on the item that is already chosen (on currently selected item).
I have the following code.
<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>