내 응용 프로그램에 여러 html 페이지가 있습니다. 그 html 파일을 f1.html, f2.html, f3.html, \ ... f454.html으로 명명했습니다. 그래서, 나는이 파일들을 사용자 선호에 의해 표시하고 싶다. 그래서 CustomMessageBox
에있는 텍스트 상자와 버튼을 NuGet
과 webview.xaml이라는 이름의 xaml 페이지를 사용하여 만들었습니다. 사용자가 텍스트 상자에 3을 입력하면 f3.html이 webview.xaml에서 열려 있어야합니다.wp8 : webbrowser에서 버튼을 클릭하여 htm 페이지 열기?
코딩 방법을 모르겠습니다. 최선의 답변은 진지하게 높이 평가 될 것입니다.
C# 코드 지금까지 [업데이트]되었습니다. webview.xaml에서
TextBox getFileNo = new TextBox();
getFileNo.Height = 72;
getFileNo.Width = 150;
getFileNo.MaxLength = 3;
TextBox getHashNo = new TextBox();
getHashNo.Height = 72;
getHashNo.Width = 150;
getHashNo.MaxLength = 3;
string showFile;
showFile = getFileNo.Text;
string hashId;
hashId = getHashNo.text;
NavigationService.Navigate(new Uri("/webview.xaml?Page=" + site, UriKind.Relative));
:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (NavigationContext.QueryString.ContainsKey("Page"))
{
var page = NavigationContext.QueryString["Page"];
browser.Navigate(new Uri("/f" + page + ".html#" + hashId, UriKind.Relative));
}
}
화려한 코드 조각. 한 가지 더 의심 스럽다. 내 응용 프로그램에서 선언 된'id'로 이동하고 싶습니다. 예 : 'f1.html # 34'. 어떻게해야합니까? –
당신도 querystring으로 넘겨 줄 수있을 것입니다 :'NavigationService.Navigate (new Uri ("/ webview.xaml? Page ="+ showFile + "& id ="+ yourId, UriKind.Relative)); ' – anderZubi
'& id =' 작동하지 않습니다 –