简体   繁体   English

基于组合框选择的按钮单击打开页面(Windows Phone应用程序)

[英]Opening pages on button click based on ComboBox selection (Windows phone apps)

Im currently learning windows phone application development. 我目前正在学习Windows Phone应用程序开发。 I have two Combobox lists. 我有两个组合框列表。 based on the selection made in combobox I need to open pages accordingly on clicking submit button. 根据组合框中的选择,我需要在单击“提交”按钮时相应地打开页面。 How can i do this using C# and xaml ? 如何使用C#和xaml执行此操作?

Use the SelectionChanged event handler within the ComboBox. 使用ComboBox中的SelectionChanged事件处理程序。 It gets fired each time you select an item in the combobox. 每次您在组合框中选择一个项目时都会触发该事件。 You can use this event to save the selected item that you require to navigate. 您可以使用此事件保存导航所需的所选项目。

 private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
        ComboBox cbx = (sender as ComboBox);
        var item = cbx.SelectedItem; // Gives you the selected item
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM