2
0
Files
maui-linux-samples/WebViewDemo/Pages/WebViewPage.xaml

154 lines
7.0 KiB
Plaintext
Raw Normal View History

2026-01-11 12:33:48 -05:00
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WebViewDemo.WebViewPage"
2026-01-11 13:34:36 -05:00
BackgroundColor="{AppThemeBinding Light={StaticResource PageBackgroundLight}, Dark={StaticResource PageBackgroundDark}}">
2026-01-11 12:33:48 -05:00
2026-01-17 08:34:04 +00:00
<Grid RowDefinitions="Auto,Auto,*,Auto">
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- Browser Toolbar -->
<Grid Grid.Row="0"
2026-01-17 07:52:05 +00:00
ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto,Auto,Auto"
2026-01-17 05:42:44 +00:00
ColumnSpacing="4"
Padding="8"
BackgroundColor="{AppThemeBinding Light={StaticResource CardBackgroundLight}, Dark={StaticResource CardBackgroundDark}}">
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- Back Button -->
<ImageButton Grid.Column="0"
x:Name="BackButton"
Source="{AppThemeBinding Light=arrow_back_light.svg, Dark=arrow_back_dark.svg}"
WidthRequest="36"
HeightRequest="36"
Padding="8"
BackgroundColor="Transparent"
2026-01-17 07:52:05 +00:00
VerticalOptions="Center"
2026-01-17 05:42:44 +00:00
Clicked="OnBackClicked"
ToolTipProperties.Text="Go Back" />
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- Forward Button -->
<ImageButton Grid.Column="1"
x:Name="ForwardButton"
Source="{AppThemeBinding Light=arrow_forward_light.svg, Dark=arrow_forward_dark.svg}"
WidthRequest="36"
HeightRequest="36"
Padding="8"
BackgroundColor="Transparent"
2026-01-17 07:52:05 +00:00
VerticalOptions="Center"
2026-01-17 05:42:44 +00:00
Clicked="OnForwardClicked"
ToolTipProperties.Text="Go Forward" />
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- Reload Button -->
<ImageButton Grid.Column="2"
x:Name="ReloadButton"
Source="{AppThemeBinding Light=refresh_light.svg, Dark=refresh_dark.svg}"
WidthRequest="36"
HeightRequest="36"
Padding="8"
BackgroundColor="Transparent"
2026-01-17 07:52:05 +00:00
VerticalOptions="Center"
2026-01-17 05:42:44 +00:00
Clicked="OnReloadClicked"
ToolTipProperties.Text="Reload Page" />
<!-- URL Bar -->
<Border Grid.Column="3"
2026-01-17 08:34:04 +00:00
BackgroundColor="{AppThemeBinding Light={StaticResource CardBackgroundLight}, Dark={StaticResource CardBackgroundDark}}"
2026-01-17 05:42:44 +00:00
StrokeThickness="1"
Stroke="{AppThemeBinding Light={StaticResource BorderLight}, Dark={StaticResource BorderDark}}"
Padding="8,4"
2026-01-17 07:52:05 +00:00
Margin="4,0"
VerticalOptions="Center">
2026-01-17 05:42:44 +00:00
<Border.StrokeShape>
<RoundRectangle CornerRadius="18" />
</Border.StrokeShape>
2026-01-11 12:33:48 -05:00
<Entry x:Name="UrlEntry"
2026-01-17 05:42:44 +00:00
Placeholder="Enter URL or search..."
2026-01-11 12:33:48 -05:00
Text="https://dotnet.microsoft.com"
FontSize="14"
2026-01-11 13:34:36 -05:00
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}"
PlaceholderColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}"
2026-01-17 05:42:44 +00:00
BackgroundColor="Transparent"
2026-01-11 12:33:48 -05:00
VerticalOptions="Center"
Completed="OnUrlSubmitted" />
2026-01-17 05:42:44 +00:00
</Border>
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- Go Button -->
<ImageButton Grid.Column="4"
x:Name="GoButton"
Source="{AppThemeBinding Light=send_light.svg, Dark=send_dark.svg}"
WidthRequest="36"
HeightRequest="36"
Padding="8"
BackgroundColor="{StaticResource AccentColor}"
CornerRadius="18"
2026-01-17 07:52:05 +00:00
VerticalOptions="Center"
2026-01-17 05:42:44 +00:00
Clicked="OnGoClicked"
ToolTipProperties.Text="Navigate" />
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- Load HTML Demo Button -->
<ImageButton Grid.Column="5"
x:Name="LoadHtmlButton"
Source="{AppThemeBinding Light=code_light.svg, Dark=code_dark.svg}"
WidthRequest="36"
HeightRequest="36"
Padding="8"
BackgroundColor="Transparent"
2026-01-17 07:52:05 +00:00
VerticalOptions="Center"
2026-01-17 05:42:44 +00:00
Clicked="OnLoadHtmlClicked"
ToolTipProperties.Text="Load Demo HTML" />
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- Eval JS Demo Button -->
<ImageButton Grid.Column="6"
x:Name="EvalJsButton"
Source="{AppThemeBinding Light=play_arrow_light.svg, Dark=play_arrow_dark.svg}"
WidthRequest="36"
HeightRequest="36"
Padding="8"
BackgroundColor="Transparent"
2026-01-17 07:52:05 +00:00
VerticalOptions="Center"
2026-01-17 05:42:44 +00:00
Clicked="OnEvalJsClicked"
ToolTipProperties.Text="Run JavaScript" />
2026-01-17 07:52:05 +00:00
<!-- Theme Toggle Button -->
<ImageButton Grid.Column="7"
x:Name="ThemeToggleButton"
Source="{AppThemeBinding Light=dark_mode.svg, Dark=light_mode.svg}"
WidthRequest="36"
HeightRequest="36"
Padding="8"
BackgroundColor="Transparent"
VerticalOptions="Center"
Clicked="OnThemeToggleClicked"
ToolTipProperties.Text="Toggle Theme" />
2026-01-17 05:42:44 +00:00
</Grid>
2026-01-11 12:33:48 -05:00
2026-01-17 08:34:04 +00:00
<!-- Loading Progress Bar (own row above WebView) -->
2026-01-17 05:42:44 +00:00
<ProgressBar Grid.Row="1"
x:Name="LoadingProgress"
HeightRequest="3"
ProgressColor="{StaticResource AccentColor}"
Progress="0"
2026-01-17 08:34:04 +00:00
IsVisible="False" />
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- WebView - Main Content Area -->
2026-01-17 08:34:04 +00:00
<WebView Grid.Row="2"
2026-01-17 05:42:44 +00:00
x:Name="MainWebView"
VerticalOptions="Fill"
HorizontalOptions="Fill"
Navigating="OnNavigating"
Navigated="OnNavigated" />
2026-01-11 12:33:48 -05:00
2026-01-17 05:42:44 +00:00
<!-- Status Bar -->
2026-01-17 08:34:04 +00:00
<Grid Grid.Row="3"
2026-01-17 05:42:44 +00:00
Padding="8,4"
BackgroundColor="{AppThemeBinding Light=#E8E8E8, Dark=#1A1A1A}">
2026-01-11 12:33:48 -05:00
<Label x:Name="StatusLabel"
Text="Ready"
2026-01-17 05:42:44 +00:00
FontSize="12"
TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}"
VerticalOptions="Center" />
</Grid>
2026-01-11 12:33:48 -05:00
</Grid>
</ContentPage>