내가하려는 것은 Windows Store 용 템플릿에 의해 생성 된 빈 페이지에 webview를 작성하는 것입니다. 그런 다음 버튼을 클릭하면 현재 웹보기가있는 페이지가 변경됩니다. 문제는 코드 비하인드에서 XAML 변수에 액세스하여 변수를 변경하는 방법을 모르겠습니다.버튼을 클릭하면 webview windows 8.1 앱을 클릭하여 페이지를 변경하는 방법
<Page
x:Class="App6.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App6"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<WebView x:Name="browser" Source="https://www.google.com/" HorizontalAlignment="Left" Height="224" Margin="463,237,0,0" VerticalAlignment="Top" Width="570"/>
<Button Content="Button" HorizontalAlignment="Left" Margin="224,110,0,0" VerticalAlignment="Top"/>
</Grid>
나는 C# 코드에서 이름 브라우저에 접근 시도했습니다. 그러나 Visual Studio에서는 찾을 수 없습니다. 나는 조금 주위를 둘러 보았지만 이것을 발견 할 수있는 예제는 많지 않았다. ... 사용법 예제를 보려면이 (http://code.msdn.microsoft.com/windowsapps/XAML-WebView-control-sample-58ad63f7)을 열려고 시도했다. browser
는 실제 제어 WebView
인 경우는
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/? LinkId=234238
namespace App6
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
}
}
}
코드 숨김 파일의 모습을 보여줄 수 있습니까? – 333
@laptou가 코드를 추가 했으니 많이 여기 없습니다. xaml을 사용하는 방법을 모르겠다. – hurnhu