-
Notifications
You must be signed in to change notification settings - Fork 9
/
MainWindow.xaml
75 lines (74 loc) · 3.03 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<Window
x:Class="Microsoft.Toolkit.Win32.Samples.WPF.WebView.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WPF="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls.WebView"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{Binding DocumentTitle, ElementName=WebView1, Mode=OneWay}"
Width="800"
Height="450"
mc:Ignorable="d">
<Window.CommandBindings>
<CommandBinding
CanExecute="BrowseBack_OnCanExecute"
Command="NavigationCommands.BrowseBack"
Executed="BrowseBack_OnExecuted" />
<CommandBinding
CanExecute="BrowseForward_CanExecute"
Command="NavigationCommands.BrowseForward"
Executed="BrowseForward_OnExecuted" />
<CommandBinding
CanExecute="GoToPage_CanExecute"
Command="NavigationCommands.GoToPage"
Executed="GoToPage_OnExecuted" />
</Window.CommandBindings>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Command="NavigationCommands.BrowseBack">
<TextBlock Text="<" />
</Button>
<Button
Grid.Column="1"
Width="30"
Command="NavigationCommands.BrowseForward">
<TextBlock Text=">" />
</Button>
<TextBox
Name="Url"
Grid.Column="2"
Padding="3,0"
VerticalContentAlignment="Center"
FontSize="16"
KeyUp="Url_OnKeyUp"
Text="{Binding Source, ElementName=WebView1, Mode=TwoWay}"
TextWrapping="NoWrap" />
<Button Grid.Column="3" Command="NavigationCommands.GoToPage">
<TextBlock Text="Go" />
</Button>
</Grid>
<WPF:WebView
Name="WebView1"
Grid.Row="1"
ContainsFullScreenElementChanged="WebView1_OnContainsFullScreenElementChanged"
IsIndexedDBEnabled="True"
IsJavaScriptEnabled="True"
IsPrivateNetworkClientServerCapabilityEnabled="True"
IsScriptNotifyAllowed="True"
NavigationCompleted="WebView1_OnNavigationCompleted"
NavigationStarting="WebView1_OnNavigationStarting"
PermissionRequested="WebView1_OnPermissionRequested"
ScriptNotify="WebView1_OnScriptNotify"
Source="https://www.bing.com" />
</Grid>
</Window>