Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding winui3 sample, separate SLN due to project structure needs #142

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions SampleApps/WebView2_WinUI3_Sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bin/
.vs/
obj/
FixedRuntime/
# Created by running event monitor
enc_temp_folder/
packages/

# Override root .gitignore to ensure we pick up changes for the sample app
!*.sln
!*.csproj

# Make sure script debug config is checked in for vendor testing
!.vscode

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity
Name="a6e38587-f17a-4a2e-8022-248694f372b3"
Publisher="CN=Microsoft"
Version="1.0.0.0" />

<Properties>
<DisplayName>WebView2_WinUI3_Sample (Package)</DisplayName>
<PublisherDisplayName>Microsoft</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="WebView2_WinUI3_Sample (Package)"
Description="WebView2_WinUI3_Sample (Package)"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
<uap:SplashScreen Image="Images\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|arm64">
<Configuration>Debug</Configuration>
<Platform>arm64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|arm64">
<Configuration>Release</Configuration>
<Platform>arm64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
<PathToXAMLWinRTImplementations>WebView2_WinUI3_Sample\</PathToXAMLWinRTImplementations>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>c55695ec-29c1-4544-857c-931372c2e7e6</ProjectGuid>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<AssetTargetFallback>net5.0-windows$(TargetPlatformVersion);$(AssetTargetFallback)</AssetTargetFallback>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<EntryPointProjectUniqueName>..\WebView2_WinUI3_Sample\WebView2_WinUI3_Sample.csproj</EntryPointProjectUniqueName>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="FixedRuntime\95.0.1020.53\\**\*.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\SplashScreen.scale-200.png" />
<Content Include="Images\LockScreenLogo.scale-200.png" />
<Content Include="Images\Square150x150Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WebView2_WinUI3_Sample\WebView2_WinUI3_Sample.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
<PublishProfile>Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfile>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="[1.0.0-experimental1]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.WindowsAppSDK.WinUI" Version="[1.0.0-experimental1]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
62 changes: 62 additions & 0 deletions SampleApps/WebView2_WinUI3_Sample/WebView2_WinUI3_Sample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "WebView2_WinUI3_Sample (Package)", "WebView2_WinUI3_Sample (Package)\WebView2_WinUI3_Sample (Package).wapproj", "{C55695EC-29C1-4544-857C-931372C2E7E6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebView2_WinUI3_Sample", "WebView2_WinUI3_Sample\WebView2_WinUI3_Sample.csproj", "{352E887C-BB2F-4BA0-89A9-B4653E9961F5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{95488D83-4C9B-4BDA-8319-B5A5E836389A}"
ProjectSection(SolutionItems) = preProject
readme.md = readme.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|arm64 = Debug|arm64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|arm64 = Release|arm64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|arm64.ActiveCfg = Debug|arm64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|arm64.Build.0 = Debug|arm64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|arm64.Deploy.0 = Debug|arm64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|x64.ActiveCfg = Debug|x64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|x64.Build.0 = Debug|x64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|x64.Deploy.0 = Debug|x64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|x86.ActiveCfg = Debug|x86
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|x86.Build.0 = Debug|x86
{C55695EC-29C1-4544-857C-931372C2E7E6}.Debug|x86.Deploy.0 = Debug|x86
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|arm64.ActiveCfg = Release|arm64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|arm64.Build.0 = Release|arm64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|arm64.Deploy.0 = Release|arm64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|x64.ActiveCfg = Release|x64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|x64.Build.0 = Release|x64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|x64.Deploy.0 = Release|x64
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|x86.ActiveCfg = Release|x86
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|x86.Build.0 = Release|x86
{C55695EC-29C1-4544-857C-931372C2E7E6}.Release|x86.Deploy.0 = Release|x86
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Debug|arm64.ActiveCfg = Debug|arm64
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Debug|arm64.Build.0 = Debug|arm64
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Debug|x64.ActiveCfg = Debug|x64
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Debug|x64.Build.0 = Debug|x64
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Debug|x86.ActiveCfg = Debug|x86
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Debug|x86.Build.0 = Debug|x86
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Release|arm64.ActiveCfg = Release|arm64
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Release|arm64.Build.0 = Release|arm64
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Release|x64.ActiveCfg = Release|x64
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Release|x64.Build.0 = Release|x64
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Release|x86.ActiveCfg = Release|x86
{352E887C-BB2F-4BA0-89A9-B4653E9961F5}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {29310077-4FDB-47DA-A8CC-6E0C9D6E619F}
EndGlobalSection
EndGlobal
15 changes: 15 additions & 0 deletions SampleApps/WebView2_WinUI3_Sample/WebView2_WinUI3_Sample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Application
x:Class="WebView2_WinUI3_Sample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WebView2_WinUI3_Sample">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Microsoft.UI.Xaml;
using System;
using System.Diagnostics;
using System.IO;
using Windows.Storage;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace WebView2_WinUI3_Sample
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();

// If your shipping a fixed version WebView2 SDK with your application you will need
// to use the following code (update the runtime version to what your shipping.

//StorageFolder localFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
//String fixedPath = Path.Combine(localFolder.Path, "FixedRuntime\\95.0.1020.53");
//Debug.WriteLine($"Launch path [{localFolder.Path}]");
//Debug.WriteLine($"FixedRuntime path [{fixedPath}]");
//Environment.SetEnvironmentVariable("WEBVIEW2_BROWSER_EXECUTABLE_FOLDER", fixedPath);

}

/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}

private Window m_window;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Window
x:Class="WebView2_WinUI3_Sample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WebView2_WinUI3_Sample"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"

mc:Ignorable="d">

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>

<Grid Grid.Row="0" Background="LightGray">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" x:Name="AddressBar" KeyDown="AddressBar_KeyDown" VerticalAlignment="Center" Margin="10,0,0,0"/>
<Button Grid.Column="1" x:Name="Go" Content="Go" Click="Go_OnClick" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>

<controls:WebView2 x:Name="WebView2" Grid.Row="1"/>

<Rectangle Grid.Row="2" Fill="LightGray"/>
<TextBlock x:Name="StatusBar" Text="WebView2" VerticalAlignment="Center" Grid.Row="2" Margin="10,0,10,0"/>
</Grid>
</Window>
Loading