我試圖編寫我的ESurvey應用程序。我有一個單選按鈕列表。這裏是SurveyPage1.xaml代碼:Windows 8.1應用程序C#XAML幫助:如果未選擇單選按鈕,則顯示消息
<StackPanel Grid.Row="1" Margin="-10,10,10,-10">
<TextBlock Text="PARLIAMENT VISITOR CENTRE SURVEY" FontWeight="Bold" FontSize="48" Margin="100,0,0,0" VerticalAlignment="Top"/>
<TextBlock Text="1. How would you describe your overall visit experience?" Margin="100,100,0,0" FontSize="18"/>
<RadioButton Name="radioExcellent" Content="Excellent" Margin="100,10,0,0" FontSize="12"/>
<RadioButton Name="radioGood" Content="Good" Margin="100,10,0,0" FontSize="12"/>
<RadioButton Name="radioAverage" Content="Average" Margin="100,10,0,0" FontSize="12"/>
<RadioButton Name="radioPoor" Content="Poor" Margin="100,10,0,0" FontSize="12"/>
</StackPanel>
<Button Name="nextButton1" Content="Next" HorizontalAlignment="Left" Margin="1250,525,0,0" Grid.Row="1" VerticalAlignment="Center" Background="#FFED2E38" Click="Button_S1_S2"/>
而且我SurveyPage1.xaml.cs:
private void Button_S1_S2(object sender, RoutedEventArgs e)
{
if (this.Frame != null)
{
this.Frame.Navigate(typeof(SurveyPage2));
}
}
我想要做的是,如果沒有無線電按鈕被選中,也不會繼續在下一頁(點擊nextButton1將顯示錯誤,說「請輸入一個選項」。)
有人可以幫助我嗎?非常感激!
嗨,感謝您的幫助。我收到此錯誤然而 錯誤類型或命名空間名稱「MessageDialog」找不到(是否缺少using指令或程序集引用?) 我不知道在哪裏修改點擊處理程序... – iamhx
嘗試在文件後面的代碼中添加'using Windows.UI.Popups;' –
是的!它現在可以工作,但不管彈出消息,它仍然會重定向到下一頁... – iamhx