开发者

C# Update Uri String

I got this code when a list item is selected the "teamsite" string changes. but how can i get the Uri addept to the teamsite string, i want new Uri(teamsite) to get the same value as the teamsite string is when i have chosen a item from the list so when i chose the Elite Junioren item, the new Uri(teamsite) equals "http://www.test2.com" instead of "http://www.test.com"

string teamsite = "http://ww开发者_高级运维w.test.com";

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
    base.OnNavigatedTo(e);
        new Uri(teamsite),
}

private void List_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
  string teamsitecheck = (string)List.SelectedItem;
  if (teamsitecheck == "Elite Junioren")
  {
  teamsite = "http://www.test2.com";
  }
  else if (teamsitecheck == "Elite Aspiranten")
  {
  teamsite = "http://www.test3.com";
  }
}

i hope i have explained it well enough, ask me for more explenation if it is needed!

(sorry for my bad grammer)


I'm not sure what you are asking (I don't even know if this is Silverlight, WPF, WinForm, etc.).

However, instead of explicitly mapping in your code, how about setting the value of the ListItem (value is different from Text, but defaults to it if not specified) to the appropriate teamsite name, so that in your code you can do:

teamsite = (Uri) List.SelectedItem.Value;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜