[英]how can i take that page1.html paeg from mainpage.xaml to secondpage.xaml and show on webControl browser?
我想顯示來自isolatedStorage的一些.html文件,這些文件位於(MainFolder-> subFolder1-> SubFolder2-> page1.html)中 。
如何將那個page1.html頁面從mainpage.xaml帶到secondpage.xaml並顯示在webControl瀏覽器上?
簡單來說:
我的secondPage.xaml包含一個Web瀏覽器控件,因此我想顯示mainpage.xaml中的page1.html,我的頁面位於上述存儲位置。
所以最后我對我的問題有一個正確的答案。 我的要求是從隔離存儲的Mainpage.xaml表單中獲取值,並顯示在SecondPage.xaml的Web瀏覽器控件上。 這就是我想要從MainBox.xaml上設置的ListBox控件中選擇圖像的全部。
因此,代碼和我提到的內聯文檔都遵循了該方案。
**//MainPage.xaml.**
private async void imgBookImage_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
//It is the way to take the id from the listView if you are showing your listView through Wrapper using ObservableCollection.
myWrapper bookName = (myWrapper)this.listCloudBooks.SelectedItem;
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
string dir = "/MainFolder/SubFolder/" + bookName.Id;
if (isf.DirectoryExists(dir))
{
NavigationService.Navigate(new Uri("/MainPage.xaml?selectedItem=" +bookName.Id, UriKind.Relative));//bookName.Id fetching Id of book and through bookid we will get the id on our destination page and will show the data.
}
else
{
//In this method i am creating folder of bookId and storing into the destination folder in my isolated storage. I am not showing the code of this method because i am answering of this question only.
DownloadBooks(bookName);
}
}
//SecondPage.xaml
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
string selectedBookId = "";//Set this variable globally.
position = 1;
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
string dir = "/MainFolder/SubFolder/" + selectedBookId;
string concatBookJson = string.Concat(dir, "/pageRecords.json");//Taking pageRecords.json, my this file have records of my *.html pages so it is showing from isolateStorage
if (isf.FileExists(concatBookJson))
{
CurrentBook = GetBookContents(concatBookJson);//Returning the Json Deserialize data from the isolated storage.
txtBookName.Text = CurrentBook.Title;//I have title property you can access all properties of your wrapper class (myWrapper).
}
}
您應該使用OnNavigated Event從MainPage.xaml中獲取值,我的要求是不同的,因此我在PhoneApplciation_Loaded事件中已進行了顯示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.