打开APP
未登录
开通VIP,畅享免费电子书等14项超值服
开通VIP
首页
好书
留言交流
下载APP
联系客服
Windows8页面参数传递
牛人的尾巴
>《windows8》
2015.12.01
关注
Windows8页面参数传递
(2013-01-17 10:14:48)
转载
▼
标签:
杂谈
public
class
Product
{
public
string
ProductName
{
get
;
set
;
}
public
string
ProductID
{
get
;
set
;
}
}
<</span>
Grid
Background
=
"{StaticResource
ApplicationPageBackgroun
dThemeBrush}"
>
<</span>
StackPanel
Margin
=
"30"
>
<</span>
TextBlock
Text
=
"通过页面传递的参数:"
Style
=
"{StaticResource
HeaderTextStyle}"
/>
<</span>
StackPanel
Orientation
=
"Horizontal"
Margin
=
"5,80,0,10"
>
<</span>
TextBlock
Text
=
"产品编号:"
FontSize
=
"28"
/>
<</span>
TextBlock
Name
=
"tbProID"
FontSize
=
"28"
/>
</</span>
StackPanel
>
<</span>
StackPanel
Orientation
=
"Horizontal"
Margin
=
"5,13,0,0"
>
<</span>
TextBlock
Text
=
"产品名称:"
FontSize
=
"28"
/>
<</span>
TextBlock
Name
=
"tbProName"
FontSize
=
"28"
/>
</</span>
StackPanel
>
</</span>
StackPanel
>
</</span>
Grid
>
protected
override
void
OnNavigatedTo(NavigationEventArgs
e)
{
//
获取参数
Product
product
=
e.Parameter
as
Product;
if
(product
!=
null
)
{
this
.tbProID.Text
=
product.ProductID;
this
.tbProName.Text
=
product.ProductName;
}
}
<</span>
Grid
Background
=
"{StaticResource
ApplicationPageBackgroun
dThemeBrush}"
>
<</span>
StackPanel
Margin
=
"30"
>
<</span>
TextBlock
Text
=
"输入产品编号:"
Style
=
"{StaticResource
SubheaderTextStyle}"
/>
<</span>
TextBox
Name
=
"txtID"
Margin
=
"5,10,5,0"
/>
<</span>
TextBlock
Margin
=
"0,20,0,0"
Text
=
"输入产品名称:"
Style
=
"{StaticResource
SubheaderTextStyle}"
/>
<</span>
TextBox
Name
=
"txtName"
Margin
=
"5,10,5,0"
/>
<</span>
Button
Content
=
"跳转"
Padding
=
"35,10,35,10"
Margin
=
"15,20,0,0"
Click
=
"onNav"
/>
</</span>
StackPanel
>
</</span>
Grid
>
private
void
onNav(
object
sender,
RoutedEventArgs
e)
{
//
取出当前窗口的根Frame
if
(Window.Current.Content
is
Frame
&&
Window.Current.Content
!=
null
)
{
Frame
myFrame
=
Window.Current.Content
as
Frame;
Product
prd
=
new
Product()
{
ProductID
=
txtID.Text,
ProductName
=
txtName.Text
};
//
导航到目标页面并传递参数
myFrame.Navigate(
typeof
(PageGet),
prd);
}
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报
。
打开APP,阅读全文并永久保存
查看更多类似文章
猜你喜欢
类似文章
【热】
打开小程序,算一算2024你的财运
Material Design Object
Windows Phone新手开发教程(二)
一步一步学Silverlight 2系列(3):界面布局
RadioButton
WPF
Silverlight 4常用StringFormat格式总结
更多类似文章 >>
生活服务
热点新闻
留言交流
回顶部
联系我们
分享
收藏
点击这里,查看已保存的文章
导长图
关注
一键复制
下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!
联系客服
微信登录中...
请勿关闭此页面
先别划走!
送你5元优惠券,购买VIP限时立减!
5
元
优惠券
优惠券还有
10:00
过期
马上使用
×