windows-runtime - 如何在 WinRT 上重复使用弹出菜单

标签 windows-runtime windows-store-apps windows-phone-8.1 winrt-xaml

我有一个项目,其中有很多不同的 ListView / GridView 项目模板。 但都共享相同的弹出菜单,就像这样

  <FlyoutBase.AttachedFlyout >
            <MenuFlyout >


                <MenuFlyoutItem x:Uid="lbl_action_sheet_title_add_to_playlist" Text="$add to playlist" />
                <MenuFlyoutItem x:Uid="lbl_action_sheet_share" Text="$share" />

            </MenuFlyout>
        </FlyoutBase.AttachedFlyout>

我想重用它而不是复制粘贴到 N 个模板

有什么想法吗?

最佳答案

您可以使用附加行为从 DataTemplate 资源附加菜单。

关于windows-runtime - 如何在 WinRT 上重复使用弹出菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28480859/

相关文章:

xaml - 如果文本太长,如何自动显示工具提示?

c++ - C/C++运行时从何而来?

c# - 将 Windows 应用商店应用程序中的 Canvas 保存为图像文件

.net - 使用 Task.Wait() 代码包装 Async/Await IAsyncOperations 有哪些风险?

javascript - 使用 FileOpenPicker 链接到本地​​计算机上的文件时,音频显示 'Invalid source'

c# - 在 Windows 应用商店应用程序中无需用户干预即可打印

email - Win8/WinRT-如何在电子邮件正文中添加换行符

c# - 在运行时创建的 ComboBox 将不会显示 Windows Phone 8.1

file - Winphone8.1开发: Can I get a List of al files stored within the Assets folder?

c# - Parse.com 绑定(bind)到 ListView ItemSource 如何