Hide the flyout when tapping on an item from the list. RRS feed

  • Question

  • 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 choosen

    (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> ... </GroupStyle> </ListView.GroupStyle> <ListView.ItemTemplate> <DataTemplate> <ContentControl Foreground="{Binding IsSelected, Converter={StaticResource ForegroundConverter}}" Content="{Binding Name}" /> </DataTemplate> </ListView.ItemTemplate> </ListView> </Flyout> </Button.Flyout>

    Does anyone know the workaround to this?
    Tuesday, September 2, 2014 6:35 AM

All replies

  • Hi, 

    From your code, i cannot reproduce this issue. Could you please share a worked sample on OneDrive?

    Wednesday, September 3, 2014 5:55 AM