备忘 windows 8.1 开发
来源:互联网 发布:织梦源码安装方法 编辑:程序博客网 时间:2024/05/28 09:31
1. Navigation
在 Page 中:
this.Frame.Navigate(typeof(MainPage));
其他:
Frame frame = Window.Current.Content as Frame;
frame.Navigate(typeof(MainPage));
在页面之间传递信息:
page1.xaml.cs
private void HyperlinkButton_Click(object sender, RoutedEventArgs e){ this.Frame.Navigate(typeof(page2), tb1.Text);}
page2.xaml.cs
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e){ string name = e.NavigationParameter as string; if (!string.IsNullOrWhiteSpace(name)) { tb1.Text = "Hello, " + name; } else { tb1.Text = "Name is required. Go back and enter a name."; }}
2.用c# 设置 button的 color
button.Background = new SolidColorBrush(Colors.Yellow);
namespace of color : Windows.UI
自定义 SolodColorBrush:
SolidColorBrush greenBrush = new SolidColorBrush(Colors.Green);
SolidColorBrush myBrush = new SolidColorBrush(Color.FromArgb(255, 20, 20, 90));
3. SearchBox
<SearchBox x:Name="mySearchBox" FocusOnKeyboardInput="True" QuerySubmitted="mySearchBox_QuerySubmitted" Height="35" />
private void mySearchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args){ this.Frame.Navigate(typeof(SearchResultsPage1), args.QueryText);}
4. Handle Back Button
如果用手机自带的返回键,需要在app.xaml.cs 中处理 BackPressedEvent
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e){ Frame frame = Window.Current.Content as Frame; if (frame == null) { return; } if (frame.CanGoBack) { frame.GoBack(); e.Handled = true; }}
如果用app中的返回键:
则自定义button的点击事件:
private void Back_Click(object sender, RoutedEventArgs e) { Frame frame = Window.Current.Content as Frame; if (frame == null) { return; } if (frame.CanGoBack) { frame.GoBack(); } }
5. WebView
xaml:
<WebView Name="webView1" Width="1000" Height="800"/>
c#:
protected override void OnNavigatedTo(NavigationEventArgs e) { Uri targetUri = new Uri(@"http://www.bing.com/"); webView.Navigate(targetUri); }
6. Handle Orientation
http://blog.jerrynixon.com/2013/12/the-two-ways-to-handle-orientation-in.html
7. Implementing search in windows 8.1 app
http://irisclasson.com/2013/12/05/implementing-search-in-windows-store-apps-8-1-screenshot-guide/
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868180.aspx
8. Zoom in/out content in webView
https://code.msdn.microsoft.com/How-to-zoom-inout-the-5a42229b
https://code.msdn.microsoft.com/windowsapps/XAML-ScrollViewer-pan-and-949d29e9
0 0
- 备忘 windows 8.1 开发
- Windows 下编程开发备忘
- Windows C++开发琐碎知识点备忘
- 开发备忘
- 备忘靠谱办法:CUDA Windows开发环境配置
- windows上eclipse搭建hadoop开发环境(自用,备忘)
- 开发Windows RT平台下的Windows应用商店应用程序的遇到的问题备忘
- Windows技巧备忘
- Windows SEH 备忘
- windows简单备忘
- Windows库(笔记备忘)
- Windows使用 备忘
- Windows 常用软件备忘
- 网页开发备忘
- media service开发备忘
- [经验总结]DB2开发备忘
- 开发技术备忘*
- Android 开发基本知识备忘
- 海量图片存储策略
- 注册时候使用 RSA 实现前台对密码加密和后台解密
- 美国必将毁于烙印
- 数学基础:角度,弧度,三角函数
- EQ降龙18掌
- 备忘 windows 8.1 开发
- GitHub使用流程- Git Shell 的一些命令总结(二) 创建代码库并学会更新
- Binary Tree Postorder Traversal
- ObjectC语言基础4—ARC、成员变量、构造方法、property
- 获取来访IP和来访地址
- [leetcode] longest substring without repeating characters
- Webstorm & PhpStorm的序列号和证书
- 秉临戤戗眷聛戤傊驺讅櫽二礯惷彛
- 鼾斫惥麤嗰驗氐驢毵涑觱聭列增在明季