A Grid
in my DataTemplate
currently has this Flyout
.
<Grid.ContextFlyout>
<MenuFlyout x:Name="AlbumFlyout">
<MenuFlyoutItem Icon="Shuffle" Text="Shuffle" />
<MenuFlyoutItem Icon="Delete" Text="Delete" />
</MenuFlyout>
</Grid.ContextFlyout>
And I also have a Flyout
generated dynamically:
public static MenuFlyout GetAddToPlaylistFlyout()
{
MenuFlyout flyout = new MenuFlyout();
flyout.Items.Add(new MenuFlyoutItem()
{
Icon = new FontIcon() { Glyph = "\uEC4F" },
Text = "Now Playing"
});
flyout.Items.Add(new MenuFlyoutSeparator());
flyout.Items.Add(new MenuFlyoutItem()
{
Icon = new SymbolIcon(Symbol.Add),
Text = "New Playlist"
});
foreach (var playlist in Settings.settings.Playlists)
{
var item = new MenuFlyoutItem()
{
Icon = new SymbolIcon(Symbol.Audio),
Text = playlist.Name
};
flyout.Items.Add(item);
}
return flyout;
}
It is dynamically generated because I need to reuse it a lot and some of its MenuFlyoutItem
is generated from user's data.
How can I insert the code-generated Flyout
right below the Shuffle
above the Delete
?
---Update---
This is part of my ListView
definition.
<ListView
x:Name="SongsListView"
Grid.Row="1"
AllowDrop="True"
CanDrag="True"
CanReorderItems="True"
ContainerContentChanging="SongsListView_ContainerContentChanging"
IsItemClickEnabled="True"
ItemClick="SongsListView_ItemClick"
ItemsSource="{Binding Songs, Mode=TwoWay}"
ReorderMode="Enabled"
SelectionMode="None">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="ContextFlyout" Value="{StaticResource ListViewItemContextFlyout}" />
</Style>
</ListView.ItemContainerStyle>
</ListView>