如何在基于新闻的应用程序中应用Windows Phone 7的页面翻转
本文关键字:Windows 应用 Phone 翻转 应用程序 于新闻 新闻 | 更新日期: 2023-09-27 18:05:43
Mainpage.xaml.cs code
public partial class MainPage : PhoneApplicationPage
{ string f;
// Constructor
public MainPage()
{
InitializeComponent();
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);
foreach (var item in rootObject)
{
// Console.WriteLine(item.news_id + "new_id");
f += '|'+item.news_id;
//f ='|' + item.news_id;
}
lstEmployee.ItemsSource = rootObject;
}
private void lstEmployee_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
int selindex = lstEmployee.SelectedIndex;
//ListBox sourceList = sender as ListBox;
//ListBox.se
(Application.Current as App).selectedNewsItem = lstEmployee.Items[lstEmployee.SelectedIndex] as NewsItem;
NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.Relative));
}
}
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 image_path { get; set; }
public string news_detail_description { get; set; }
}
}
page1.xaml.cs
public Page1()
{
InitializeComponent();
Loaded += new RoutedEventHandler(Page1_Loaded);
}
void Page1_Loaded(object sender, RoutedEventArgs e)
{
NewsItem selectedNewsItem = (Application.Current as App).selectedNewsItem;
// TextBlockNewsDescription.Text = selectedNewsItem.news_detail_description;
string strURI= selectedNewsItem.news_detail_description;
// strURI.Replace("<link href='http://www.taxmann.com/css/taxmannstyle.css' rel='stylesheet' type='text/css' />", "");
// string k = "<html><body style='background-color:Black;font-size:30px;color:#fff;'>" + strURI + "</body></html>";
string k = "<html><body href='http://www.taxmann.com/css/taxmannstyle.css' rel='stylesheet' type='text/css'>" + strURI + "</body></html>";
webBrowser1.NavigateToString(k);
}
}
}
我想在page1中应用翻页。Xaml I能够在主页中显示数据。Xaml在listview和在page1. Xaml .cs我显示数据在web视图根据其主页的项目现在我想page1。Xaml翻转假设用户翻到下一页,那么下一个项目的详细信息应该显示在,如果前一个翻转,那么它应该显示前一个新闻的详细信息。(如android视图页)
我必须在windows Phone 7中创建基于新闻的应用程序,请帮助我
可以使用全景模板代替原来的模板
可以向Page1添加Pivot控件。xaml,将其绑定到NewsItem集合,并将currentItem
设置为selectedNewsItem