One Listview with ListViewItems having each a FlyOut Menu attached


  • Hello,

    I am writing an app using SwapChainPanel and XAML UI elements. One of these is a ListView that is declared as follows:

    <ListView x:Name="ListViewItems" Width="225" VerticalAlignment="Stretch" HorizontalAlignment="Right" Header="Markers" SelectionMode="Multiple" RightTapped="ListViewItems_RightTapped" IsItemClickEnabled="True" ItemClick="ListViewItems_ItemClick" SelectionChanged="ListViewItems_SelectionChanged_1" IsSwipeEnabled="True">

    To every ListViewItem that is part of the ListView, I want to attach a FlyOut like this:

    FlyoutBase.AttachedFlyout="{StaticResource FlyoutBase1}"

    Actually, I am using an item template like this:

                        <StackPanel Orientation="Horizontal" Width="292" Height="80">

    So, my question is, how to attach this FlyOut by XAML or programmatically to every single data bound ListViewItem; yet I only know how to attach the FlyOut to the whole ListView. This is not my intention, because the FlyOuts attached to the whole control are always positioned on the same location and not beneath the clicked ListViewItem. Further on, I want to change the content of the FlyOut dependent on which ListViewItem was clicked.

    Thanks for your help in advance!


    Saturday, January 4, 2014 7:12 PM