Reconstruct XamlBrowser sample with XAML from decompiled code
Created complete XamlBrowser sample application: - App.xaml: Colors and styles for light/dark theme support - App.xaml.cs: BrowserApp with ToggleTheme() - MainPage.xaml: Toolbar (Back, Forward, Refresh, Stop, Home), address bar, Go button, WebView, status bar with theme toggle - MainPage.xaml.cs: Navigation logic, URL handling, progress animation - MauiProgram.cs: UseLinuxPlatform() configuration - Program.cs: LinuxProgramHost entry point - Resources/Images: 10 SVG icons for toolbar (dark/light variants) UI matches screenshot provided by user: - Dark gray toolbar with navigation buttons - Entry field for URL with rounded corners - Green "Go" button - WebView displaying content - Status bar with theme toggle 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
133
samples/XamlBrowser/MainPage.xaml
Normal file
133
samples/XamlBrowser/MainPage.xaml
Normal file
@@ -0,0 +1,133 @@
|
||||
<?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="XamlBrowser.MainPage"
|
||||
Title="XAML Browser"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource PageBackgroundLight}, Dark={StaticResource PageBackgroundDark}}">
|
||||
|
||||
<Grid RowDefinitions="Auto,Auto,*,Auto">
|
||||
|
||||
<!-- Toolbar -->
|
||||
<Grid Grid.Row="0"
|
||||
ColumnDefinitions="Auto,Auto,Auto,Auto,Auto,*,Auto"
|
||||
Padding="12,8"
|
||||
ColumnSpacing="8"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource ToolbarBackgroundLight}, Dark={StaticResource ToolbarBackgroundDark}}">
|
||||
|
||||
<!-- Back Button -->
|
||||
<ImageButton Grid.Column="0"
|
||||
Source="{AppThemeBinding Light=arrow_back_dark.png, Dark=arrow_back_light.png}"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
CornerRadius="20"
|
||||
Padding="8"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource ButtonBackgroundLight}, Dark={StaticResource ButtonBackgroundDark}}"
|
||||
Clicked="OnBackClicked"
|
||||
AutomationId="BackButton"
|
||||
ToolTipProperties.Text="Go Back" />
|
||||
|
||||
<!-- Forward Button -->
|
||||
<ImageButton Grid.Column="1"
|
||||
Source="{AppThemeBinding Light=arrow_forward_dark.png, Dark=arrow_forward_light.png}"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
CornerRadius="20"
|
||||
Padding="8"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource ButtonBackgroundLight}, Dark={StaticResource ButtonBackgroundDark}}"
|
||||
Clicked="OnForwardClicked"
|
||||
AutomationId="ForwardButton"
|
||||
ToolTipProperties.Text="Go Forward" />
|
||||
|
||||
<!-- Refresh Button -->
|
||||
<ImageButton Grid.Column="2"
|
||||
Source="{AppThemeBinding Light=refresh_dark.png, Dark=refresh_light.png}"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
CornerRadius="20"
|
||||
Padding="8"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource ButtonBackgroundLight}, Dark={StaticResource ButtonBackgroundDark}}"
|
||||
Clicked="OnRefreshClicked"
|
||||
AutomationId="RefreshButton"
|
||||
ToolTipProperties.Text="Refresh" />
|
||||
|
||||
<!-- Stop Button -->
|
||||
<ImageButton Grid.Column="3"
|
||||
Source="{AppThemeBinding Light=close_dark.png, Dark=close_light.png}"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
CornerRadius="20"
|
||||
Padding="8"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource ButtonBackgroundLight}, Dark={StaticResource ButtonBackgroundDark}}"
|
||||
Clicked="OnStopClicked"
|
||||
AutomationId="StopButton"
|
||||
ToolTipProperties.Text="Stop" />
|
||||
|
||||
<!-- Home Button -->
|
||||
<ImageButton Grid.Column="4"
|
||||
Source="{AppThemeBinding Light=home_dark.png, Dark=home_light.png}"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
CornerRadius="20"
|
||||
Padding="8"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource ButtonBackgroundLight}, Dark={StaticResource ButtonBackgroundDark}}"
|
||||
Clicked="OnHomeClicked"
|
||||
AutomationId="HomeButton"
|
||||
ToolTipProperties.Text="Go Home" />
|
||||
|
||||
<!-- Address Bar -->
|
||||
<Entry x:Name="AddressBar"
|
||||
Grid.Column="5"
|
||||
Style="{StaticResource AddressBarStyle}"
|
||||
Placeholder="Enter URL or search..."
|
||||
Completed="OnAddressBarCompleted"
|
||||
AutomationId="AddressBar" />
|
||||
|
||||
<!-- Go Button -->
|
||||
<Button Grid.Column="6"
|
||||
Text="Go"
|
||||
Style="{StaticResource GoButtonStyle}"
|
||||
Clicked="OnGoClicked"
|
||||
AutomationId="GoButton" />
|
||||
</Grid>
|
||||
|
||||
<!-- Loading Progress Bar -->
|
||||
<ProgressBar x:Name="LoadingProgress"
|
||||
Grid.Row="1"
|
||||
IsVisible="False"
|
||||
HeightRequest="3"
|
||||
ProgressColor="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource PrimaryDarkColor}}"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource EntryBackgroundLight}, Dark={StaticResource EntryBackgroundDark}}" />
|
||||
|
||||
<!-- WebView -->
|
||||
<WebView x:Name="BrowserWebView"
|
||||
Grid.Row="2"
|
||||
Source="https://openmaui.net"
|
||||
Navigating="OnWebViewNavigating"
|
||||
Navigated="OnWebViewNavigated" />
|
||||
|
||||
<!-- Status Bar -->
|
||||
<Grid Grid.Row="3"
|
||||
ColumnDefinitions="*,Auto"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource StatusBackgroundLight}, Dark={StaticResource StatusBackgroundDark}}">
|
||||
|
||||
<Label x:Name="StatusLabel"
|
||||
Grid.Column="0"
|
||||
Text="Ready"
|
||||
Style="{StaticResource StatusLabelStyle}"
|
||||
VerticalOptions="Center" />
|
||||
|
||||
<ImageButton x:Name="ThemeToggle"
|
||||
Grid.Column="1"
|
||||
Source="{AppThemeBinding Light=dark_mode_dark.png, Dark=light_mode_light.png}"
|
||||
WidthRequest="32"
|
||||
HeightRequest="32"
|
||||
CornerRadius="16"
|
||||
Padding="6"
|
||||
Margin="4"
|
||||
BackgroundColor="Transparent"
|
||||
Clicked="OnThemeToggleClicked"
|
||||
AutomationId="ThemeToggle"
|
||||
ToolTipProperties.Text="Toggle Theme" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
Reference in New Issue
Block a user