【发布时间】:2013-08-14 16:50:01
【问题描述】:
我有 100 个 html 文件。我知道如何为单个 xaml 页面初始化 <phone:webBrowser />。但是,如果我使用这种方法,那么我需要通过在其中初始化 webbrowser 来创建 100 个 xaml 页面,并且我可以通过单击按钮来导航该 xaml 页面。但是,这是浪费时间。
所以,我在 webview.xaml 中创建了 <phone:webBrowser> 并在 chapters.xaml 中创建了 100 个按钮
我要问的是,如果在chapters.xaml 中按下button1,chapter1.html 应该在webview.xaml 中打开。如果在chapters.xaml 中按下button2,则chapter2.html 应该在webview.xaml 中打开。像这样,所有 100 个文件都应该在 webview.xaml 中打开,通过相应的按钮单击 chapters.xaml。怎么打开?
我的chapters.xaml 页面:
<Button Content="Chapter 1" Click="webview"/>
<Button Content="Chapter 2" Click="webview"/>
/.../
<Button Content="Chapter 100" Click="webview"/>
我的chapters.cs 页面:
private void webview(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/webview.xaml", UriKind.Relative));
}
我的webview.xaml 页面:
<phone:WebBrowser x:Name="browser" IsScriptEnabled="True" Margin="-12,0,-11,0" />
我没有在webview.cs页面中给出什么,请帮助我在cs页面中给出什么来打开html页面?提前谢谢。!!!
【问题讨论】:
标签: c# xaml navigation