Sag*_*gar 2 c# xaml win-universal-app
我想从一个页面导航到另一个页面.
如果我的目标页面构造函数定义为,
public Bills()
{
this.InitializeComponent();
}
Run Code Online (Sandbox Code Playgroud)
对于我使用的正常导航
Frame.Navigate(typeof(Billing.Bills));
Run Code Online (Sandbox Code Playgroud)
它的工作正常.假设我的目标页面构造函数包含一些参数,例如
public Bills(string strBillType, string strExchangeAmount, RootObject objRoot, string strPaymentType)
{
this.InitializeComponent();
}
Run Code Online (Sandbox Code Playgroud)
在上述情况下,我如何导航到目标页面?.
您需要使用重载方法 Navigate(Type sourcePageType, System.Object parameter)
为参数创建类:
public class BillParameters
{
//your properties
public BillParameters(string strBillType, string strExchangeAmount, RootObject objRoot, string strPaymentType)
{
}
}
Run Code Online (Sandbox Code Playgroud)
传递你的参数:
var parameters = new BillParameters(strBillType, strExchangeAmount, objRoot, strPaymentType);
Frame.Navigate(typeof(Billing.Bills), parameters);
Run Code Online (Sandbox Code Playgroud)
并在目标网页上重试
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
var parameters = e.Parameter as BillParameters;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1712 次 |
| 最近记录: |