ContextFlyout 在10586或10240的使用
虽然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的使用的更多相关文章
- 【Win10】探索 Windows 10 10586 之 JumpList(跳转列表)
Windows 10 10586 出来了也挺久的了,应该大部分都从 10240 升级到这个版本了.在 10586 中,微软添加了 200 多个新的 API,具体 API 的变动,大家可以点击下面这个链 ...
- win10 enterprise 10240激活:
win10 enterprise 10240激活: 以管理员命令:slmgr /upkslmgr /ipk NPPR9-FWDCX-D2C8J-H872K-2YT43slmgr /skms kms.x ...
- Win10 10586 更新
最近发现,电脑c盘突然少了许多,发现c盘多了个windowsBT文件夹,大概6个G,恩,win10 又推出更新了,版本10586. 不知道为啥,更新时win10 把原来的下载的删除了,大概出了什么错误 ...
- 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的错误问题 ...
- 安装 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 后,有可能造成原本已安装的 ...
- windows 10预览版升级win10 7月29 10240.16384
一路追着win10 从预览版到今天10240.16384 昨晚是中国区第一批下载win10的,不过不是第一批安装的. 早上才安装成功. win10预览版更新 7月29 1024016384 使用esd ...
- win7升级为Win10 10586版本,出现应用商店打不开的解决办法
把公司的win7升级为了win10,但是打开应用商店时是白的,什么都没有,过一会之后,会有提示信息. 报的错误是: 错误代码:0X80072ee2 最后,我的解决办法是: 首先,咱们返回到win10 ...
- win10 10586 关机便利贴报内存不能为 read 应用程序错误
解决方案: 最小化便利贴后关机.
- 【数论】UVa 10586 - Polynomial Remains
Problem F: Polynomial Remains Given the polynomial a(x) = an xn + ... + a1 x + a0, compute the remai ...
随机推荐
- mysql binlog_row_image的选择
其含义为 The default value is full. In MySQL 5.5 and earlier, full row images are always used for both b ...
- PowerDesigner 常用设置
1.使用 JDBC 方式连接 Oracle 逆向生成数据库 PDM 使用 ODBC 方式连接 Oracle 数据库可以借鉴这位兄弟的博客:http://www.cnblogs.com/clivehua ...
- FreeMarker的基础语法
FreeMarker语言 FreeMarker语言概述 FreeMarker是一个模板引擎,一个基于模板生成文本输出的通用工具,使用纯Java编写. FreeMarker被设计用来生成HTML Web ...
- atitit.http原理与概论attilax总结
atitit.http原理与概论attilax总结 1. 图解HTTP 作者:[日]上野宣 著1 2. HTTP权威指南(国内首本HTTP及其相关核心Web技术权威著作)1 3. TCP/IP详解(中 ...
- 负载均衡之LVS集群
h3 { color: rgb(255, 255, 255); background-color: rgb(30,144,255); padding: 3px; margin: 10px 0px } ...
- 在js中为图片的src赋值时,src的值不能在开头用 破浪号~
<img id="aa" src="~/Content/Manager/no01.png" /> document.getElementById(& ...
- jquery toggle方法使用出错?请看这里-遁地龙卷风
这个函数在1.9之前和1.9之后的用法大不相同 1 1.9之间,用于点击元素时函数的轮流执行 toggle(function() { alert(1);//1,3,5,7... },function( ...
- android 自定义控件——(二)圆形按钮,圆形View
----------------------------------↓↓圆形按钮,圆形View(源代码下有属性解释)↓↓---------------------------------------- ...
- SQLite使用(三)&&核心API使用
概述 SQLite提供了一系列接口供用户访问数据库,主要包括连接数据库,处理SQL,迭代查询结果等.本文会针对我们使用SQLite的主要场景,列出核心的API,详细介绍API的用法并给出代码用 ...
- 基于TCP的网络编程
HTTP协议,FTP协议等很多广泛应用的协议均基于TCP协议.TCP编程主要为C/S模式,客户端和服务器之间的程序设计存在较大差异. TCP编程框图 服务器调用socket().bind().list ...