I’m working on this win8 app that includes a combo box. The combo box contains a list of topics and when a single topic is clicked, it opens up a webpage. Not in a browser but in a WebView. I’ve tried doing it with switch and this what I came up with. But I get an error on the MainPage.xaml that says that:
‘System.Threading.Tasks.Task Reader.MainPage.ComboBox_selectionChanged(object, Windows.UI.Xaml.Controls.SelectionChangedEventArgs)’ has the wrong return type
I’d prefer not to have to use a button. I’ve looked into binding but I don’t understand how it works very well. How can I fix this problem? Thanks.
private async Task ComboBox_selectionChanged(object sender, SelectionChangedEventArgs e)
{
switch (selectUrl.SelectedIndex)
{
case 1:
await GetFeeds("http://...");
break;
case 2:
await GetFeeds("http://...");
break;
case 3:
await GetFeeds("http://...");
break;
case 4:
await GetFeeds("http://...");
break;
case 5:
await GetFeeds("http://...");
break;
}
}
Below is the code for Combo_Box you have to set the return type to ‘void’ or other problem can be with how u get the selected item . try getting it into variable of type ‘ComboBox’ as below