public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
myButton.Click += new RoutedEventHandler(myButton_Click);
}
void myButton_Click(object sender, RoutedEventArgs e)
{
WebClient webClient = new WebClient();
webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
webClient.DownloadStringAsync(new Uri("http://www.taxmann.com/TaxmannWhatsnewService/mobileservice.aspx?service=topstories"));
}
void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
var rootObject = JsonConvert.DeserializeObject<List<NewsItem>>(e.Result);
lstEmployee.ItemsSource = rootObject;
}
public class NewsItem
{
public string news_id { get; set; }
public string news_title { get; set; }
public string website_link { get; set; }
public string imagepath { get; set; }
public string news_date { get; set; }
public string news_detail_description { get; set; }
}
}
这是我的代码,我可以在 Listview news_title 和 news_data 中打印数据。
现在我想选择特定新闻项目的项目并在另一个页面中显示它的 news_description。
请帮助我如何实施。