一、跳转的触发
分为左键触发和右键触发,左键触发的事件以及其处理方法
GridView_RightTapped
var Info = (e.OriginalSource as FrameworkElement)?.DataContext as InfoMdoel;
右键触发的事件以及其处理方法:
GridView_SelectionChanged
InfoMdoel ObjSen = new InfoMdoel();
foreach (var item in e.AddedItems)
{
ObjSen = (InfoMdoel)item;
}
二、新窗体方法:
1.使用提示框:
ContentDialog content_dialog = new ContentDialog()
{
Title = "设备"+Info.Type+"详情",
Content = "设备状态:"+Info.Statue,
PrimaryButtonText = "返回",
SecondaryButtonText = "删除设备",
FullSizeDesired = true,
};
ContentDialogResult Reslut = await content_dialog.ShowAsync();
if (Reslut == ContentDialogResult.Secondary)
{
//返回第二个按键的处理
}
导航到另外一个界面:
var Reslut= Frame.Navigate(typeof(DetailPage), Info);
另外一个界面需要添加构造函数:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.Parameter.GetType().Equals(typeof(InfoMdoel)))
{
InfoMdoel ObjSen = (InfoMdoel)e.Parameter;
txtTitle.Text = ObjSen.Type;
txtStatue.Text = ObjSen.Statue;
}
}