c# listbox windows-phone-8.1 contextmenu flyout

c# - FlyOut en el error de DataTemplate WP 8.1



listbox windows-phone-8.1 (0)

Tengo un DataTemplate para los elementos ListBox. Me gustaría que cuando el usuario tiene un elemento de la lista, un desplegable abierto aparezca sobre el elemento con algunas opciones. Entonces, cuando tengo un elemento del cuadro de lista, en el modo de depuración, ingreso el método pero se bloquea diciéndome que no hay flyoutBase conectado a ese elemento, pero hay ... Al usar un DataTemplateSelector personalizado, el DataTemplate está escrito en el App.xaml como un recurso. Este es mi DataTemplate para ListBoxItem:

<DataTemplate x:Key="FollowerOuterTemplate"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" > <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Name="FollowersList"> <FlyoutBase.AttachedFlyout> <MenuFlyout> <MenuFlyoutItem Text="Delete" /> <MenuFlyoutItem Text="Refresh" /> <MenuFlyoutItem Text="Share" /> </MenuFlyout> </FlyoutBase.AttachedFlyout> <StackPanel Orientation="Vertical" Width="282"> <TextBlock Grid.Row="0" FontSize="33" Text="{Binding Pseudo}" Foreground="Gray" Height="46" Margin="0,0,-0.333,0"/> <TextBlock Grid.Row="1" FontSize="20" Text="{Binding NomPrenom}" Foreground="#5bc5eb" Height="27" Margin="0,0,-0.333,0"/> <TextBlock Grid.Row="2" FontSize="20" Text="Restez appuyer pour bloquer" Foreground="#BCC6CC" Height="27" Margin="0,0,-0.333,0"/> </StackPanel> <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" Width="113"> <Image Name="StatutContact" Height="43" Source="/Ressources/Images/checkedTests2.png" Stretch="Fill" Margin="0,20,0,0" Width="44" HorizontalAlignment="Center"/> </StackPanel> </StackPanel> </StackPanel> </DataTemplate>

Y aquí está mi método llamado:

private void FollowersList_Holding(object sender, HoldingRoutedEventArgs e) { try { FrameworkElement senderElement = sender as FrameworkElement; FrameworkElement element = sender as FrameworkElement; if (element == null) return; // If the menu was attached properly, we just need to call this handy method FlyoutBase.ShowAttachedFlyout(element); } catch (Exception ex) { } }

El error exacto es: System.ArgumentException: el parámetro es incorrecto. Se ha llamado a ShowAttached a un elemento sin FlyoutBase adjunto