虽然ContextFlyout只能在红石以上版本使用,但可以采用附加属性的方法手动写一个

    public static class ContextFlyoutSetter
{
public static Windows.UI.Xaml.Controls.Primitives.FlyoutBase GetCompatibleContextFlyout(FrameworkElement obj)
{
return (Windows.UI.Xaml.Controls.Primitives.FlyoutBase)obj.GetValue(CompatibleContextFlyoutProperty);
} public static void SetCompatibleContextFlyout(FrameworkElement obj, Windows.UI.Xaml.Controls.Primitives.FlyoutBase value)
{
obj.SetValue(CompatibleContextFlyoutProperty, value);
}
static readonly bool issupport = Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "ContextFlyout");
// Using a DependencyProperty as the backing store for ContextFlyout. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CompatibleContextFlyoutProperty =
DependencyProperty.RegisterAttached("CompatibleContextFlyout", typeof(Windows.UI.Xaml.Controls.Primitives.FlyoutBase), typeof(FrameworkElement), new PropertyMetadata(null, CompatibleContextFlyoutChanged));
private static void CompatibleContextFlyoutChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
var uie=obj as FrameworkElement;
if(uie!=null)
{
if(issupport )
{
uie.ContextFlyout = e.NewValue as Windows.UI.Xaml.Controls.Primitives.FlyoutBase;
}
else
{
Windows.UI.Xaml.Controls.Primitives.FlyoutBase.SetAttachedFlyout(uie, e.NewValue as Windows.UI.Xaml.Controls.Primitives.FlyoutBase);
if (e.NewValue!=null)
{
uie.Holding += Uie_Holding;
uie.RightTapped += Uie_RightTapped;
}
else
{
uie.Holding -= Uie_Holding;
uie.RightTapped -= Uie_RightTapped;
}
}
}
} private static void Uie_Holding(object sender, Windows.UI.Xaml.Input.HoldingRoutedEventArgs e)
{
Windows.UI.Xaml.Controls.Primitives.FlyoutBase.ShowAttachedFlyout(sender as FrameworkElement);
} private static void Uie_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
{
Windows.UI.Xaml.Controls.Primitives.FlyoutBase.ShowAttachedFlyout(sender as FrameworkElement);
}
}

最后使用的时候只需要这样

                            <localControls:ContextFlyoutSetter.CompatibleContextFlyout>
<MenuFlyout> </MenuFlyout>
</localControls:ContextFlyoutSetter.CompatibleContextFlyout>

ContextFlyout 在10586或10240的使用的更多相关文章

  1. 【Win10】探索 Windows 10 10586 之 JumpList(跳转列表)

    Windows 10 10586 出来了也挺久的了,应该大部分都从 10240 升级到这个版本了.在 10586 中,微软添加了 200 多个新的 API,具体 API 的变动,大家可以点击下面这个链 ...

  2. win10 enterprise 10240激活:

    win10 enterprise 10240激活: 以管理员命令:slmgr /upkslmgr /ipk NPPR9-FWDCX-D2C8J-H872K-2YT43slmgr /skms kms.x ...

  3. Win10 10586 更新

    最近发现,电脑c盘突然少了许多,发现c盘多了个windowsBT文件夹,大概6个G,恩,win10 又推出更新了,版本10586. 不知道为啥,更新时win10 把原来的下载的删除了,大概出了什么错误 ...

  4. pycrypto安装出错的问题 intmax_t C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\inttypes.

    前言: 需要安装 Microsoft Visual Studio2017 Community 或者buildtools 解决方案一(解决了python3.7上安装pycrypto-2.6.1的错误问题 ...

  5. 安装 VS 2015 Update 2 + Windows SDK Tools 1.3.1 + Windows SDK 10586.212 后提示找不到 10586.0 SDK 问题的解决方法

    将 Visual Studio 2015 升级到 Update 2,并安装 Windows SDK Tools 1.3.1 和 Windows SDK 10586.212 后,有可能造成原本已安装的 ...

  6. windows 10预览版升级win10 7月29 10240.16384

    一路追着win10 从预览版到今天10240.16384 昨晚是中国区第一批下载win10的,不过不是第一批安装的. 早上才安装成功. win10预览版更新 7月29 1024016384 使用esd ...

  7. win7升级为Win10 10586版本,出现应用商店打不开的解决办法

    把公司的win7升级为了win10,但是打开应用商店时是白的,什么都没有,过一会之后,会有提示信息. 报的错误是: 错误代码:0X80072ee2 最后,我的解决办法是: 首先,咱们返回到win10 ...

  8. win10 10586 关机便利贴报内存不能为 read 应用程序错误

    解决方案: 最小化便利贴后关机.

  9. 【数论】UVa 10586 - Polynomial Remains

    Problem F: Polynomial Remains Given the polynomial a(x) = an xn + ... + a1 x + a0, compute the remai ...

随机推荐

  1. 在Thinkphp中使用AJAX实现无刷新分页

    在Thinkphp目录的Lib\ORG\Util\目录里新建AjaxPage.class.php,写入一下内容: <?php // +------------------------------ ...

  2. 关于css3的背景渐变

    关于css3的渐变,目前各大浏览器还未做到很好的支持,所以需要在我们使用时加上各大浏览器前缀. -moz-:使用Mozilla内核的浏览器(Firefox浏览器) -webkit-:使用Webkit内 ...

  3. SharePoint 是哪些人设计、开发的?

    闲下来的时候,我有时候会想:SharePoint 是哪些人设计.开发的? 毕竟,你说一个单选的字段,你从列表里面添加的时候,字段类型选的是 “Yes/No”:而如果你是通过编程把它加入列表的时候,字段 ...

  4. ArcGIS Engine开发前基础知识(1)

    ArcGIS二次开发是当前gis领域的一项重要必不可少的技能.下面介绍它的基本功能 一.ArcGIS Engine功能 在使用之前首先安装和部署arcgis sdk,(在这里不在赘述相关知识)可以实现 ...

  5. JAVA Shallow heap & Retained heap

    最近在研究内存泄漏的问题,在使用MAT工具中发现了Shallow heap & Retained heap,不懂. 然后在网上找了一些资料. Shallow Size 对象自身占用的内存大小, ...

  6. GreenDao2.2升级GreenDao3.0的适配之路

    前言.为什么要升级到Greendao3.0? 1. 多人开发 以往的数据库建表建Dao等操作要新开一个module,在统一的地方管理数据库建表,现在可以直接写Entity.多人开发时自己管自己的Ent ...

  7. Android中使用Notification实现进度通知栏(Notification示例三)

    我们在使用APP的过程中,软件会偶尔提示我们进行版本更新,我们点击确认更新后,会在通知栏显示下载更新进度(已知长度的进度条)以及安装情况(不确定进度条),这就是我们今天要实现的功能.实现效果如下: 在 ...

  8. swift-可选值

    swift的nil和OC有些不一样,OC只有对象可以用nil,swift基础类型(整形,浮点)没有值时也是nil,当初始化的时候,swift可以没有初始值的,产生了可选值Optional. 定义可选值 ...

  9. LeetCode题解-----Sliding Window Maximum

    题目描述: Given an array nums, there is a sliding window of size k which is moving from the very left of ...

  10. Linux下的串口编程及非阻塞模式

    本篇介绍了如何在linux系统下向串口发送数据.包括read的阻塞和非阻塞.以及select方法. 打开串口 在Linux系统下,打开串口是通过使用标准的文件打开函数操作的. #include < ...