【发布时间】:2014-04-13 18:28:10
【问题描述】:
我正在尝试将字符串传递给不同 xaml 页面中的文本块
我有一个页面 (Gender.xaml),其中有两个按钮(男性和女性),当用户单击该按钮时,它将打开另一个问题页面。
我正在尝试在 question.xaml 页面顶部的标签 TextBlock 中显示用户选择的按钮的性别。
在其他 Questions.xaml 页面中传递/显示字符串值的代码是什么
这是我目前在 Gender.xaml 页面中的内容
private void MaleButton_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Questions.xaml", UriKind.Relative));
GenderLabel.Text = string.Format("Male");
}
private void FemaleButton_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Questions.xaml", UriKind.Relative));
GenderLabel.Text = string.Format("Female");
}
感谢任何帮助或建议
【问题讨论】: