C# 当按钮为“单击UWP”时,导航到具有选定组合框项的新页面

C# 当按钮为“单击UWP”时,导航到具有选定组合框项的新页面,c#,uwp,C#,Uwp,我希望用户在组合框中选择一个项目,当他们按下按钮时,他们将被重定向到特定页面。我怎样才能做到这一点 单击按钮时,只需选中组合框的选定属性,并进行相应导航 转到您的按钮单击事件,从Combobox生成SelectCase。SelectedIndex, 并处理每宗个案: 还请展示一些与您所做工作相关的c#代码。谢谢 private void Navtocapus_Click(object sender, args) { if(Campus_Selector.SelectedIndex

我希望用户在组合框中选择一个项目,当他们按下按钮时,他们将被重定向到特定页面。我怎样才能做到这一点


单击按钮时,只需选中组合框的选定属性,并进行相应导航


转到您的按钮单击事件,从Combobox生成SelectCase。SelectedIndex, 并处理每宗个案:

还请展示一些与您所做工作相关的c#代码。谢谢
private void Navtocapus_Click(object sender, args)
{
    if(Campus_Selector.SelectedIndex != -1)//just to make sure an item is selected
    {
        string item = (Campus_Selector.SelectedItem as ComboboxItem).Content as string;
        //use whatever your frame is to navigate to your desired page using value of item.
        frame.Navigate(typeof(YourPageClass));
    }
}
Select case Combobox.SelectedIndex;
case 1;
Frame.Navigate(SomePage);
case 2;
Frame.Navigate(SomeotherPage);
...