-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from egvijayanand/working
Native Embedding WinUI 3 Sample (.NET 8)
- Loading branch information
Showing
31 changed files
with
493 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<MauiVersion>8.0.7</MauiVersion> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.5.33103.201 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbeddedWindows", "EmbeddedWindows\EmbeddedWindows.csproj", "{A96B3752-FF0F-402B-A85A-634E934202F1}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MauiLib", "MauiLib\MauiLib.csproj", "{E93EB175-0FD3-4BFD-B81A-CDAF33998932}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {33E05B3D-B1D3-476F-9E8D-E1E471B55750} | ||
EndGlobalSection | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Debug|Any CPU.ActiveCfg = Debug|x86 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Debug|Any CPU.Build.0 = Debug|x86 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Debug|x64.ActiveCfg = Debug|x64 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Debug|x64.Build.0 = Debug|x64 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Debug|x86.ActiveCfg = Debug|x86 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Debug|x86.Build.0 = Debug|x86 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Release|Any CPU.ActiveCfg = Release|x86 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Release|Any CPU.Build.0 = Release|x86 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Release|x64.ActiveCfg = Release|x64 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Release|x64.Build.0 = Release|x64 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Release|x86.ActiveCfg = Release|x86 | ||
{A96B3752-FF0F-402B-A85A-634E934202F1}.Release|x86.Build.0 = Release|x86 | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Debug|x64.Build.0 = Debug|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Debug|x86.Build.0 = Debug|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Release|x64.ActiveCfg = Release|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Release|x64.Build.0 = Release|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Release|x86.ActiveCfg = Release|Any CPU | ||
{E93EB175-0FD3-4BFD-B81A-CDAF33998932}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Application | ||
x:Class="EmbeddedWindows.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:EmbeddedWindows" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> | ||
<!-- Other merged dictionaries here --> | ||
</ResourceDictionary.MergedDictionaries> | ||
<!-- Other app resources here --> | ||
<Color x:Key="Primary">#512BD4</Color> | ||
|
||
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}" /> | ||
<SolidColorBrush x:Key="WhiteBrush" Color="White" /> | ||
<SolidColorBrush x:Key="BlackBrush" Color="Black" /> | ||
|
||
<x:Double x:Key="AppFontSize">14</x:Double> | ||
|
||
<Style x:Key="MyLabel" TargetType="TextBlock"> | ||
<Setter Property="Foreground" | ||
Value="{StaticResource PrimaryBrush}" /> | ||
</Style> | ||
|
||
<Style x:Key="Action" TargetType="Button"> | ||
<Setter Property="FontSize" | ||
Value="{StaticResource AppFontSize}" /> | ||
<Setter Property="Padding" | ||
Value="14,10" /> | ||
</Style> | ||
|
||
<Style x:Key="PrimaryAction" | ||
TargetType="Button" | ||
BasedOn="{StaticResource Action}"> | ||
<Setter Property="Background" | ||
Value="{StaticResource PrimaryBrush}" /> | ||
<Setter Property="CornerRadius" | ||
Value="8" /> | ||
<Setter Property="Foreground" | ||
Value="{StaticResource WhiteBrush}" /> | ||
</Style> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace EmbeddedWindows | ||
{ | ||
/// <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(); | ||
} | ||
|
||
/// <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(LaunchActivatedEventArgs args) | ||
{ | ||
m_window = new MainWindow(); | ||
m_window?.Activate(); | ||
} | ||
|
||
private Window? m_window; | ||
} | ||
} |
Binary file added
BIN
+432 Bytes
src/NET_8/EmbeddedWindows/EmbeddedWindows/Assets/LockScreenLogo.scale-200.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.25 KB
src/NET_8/EmbeddedWindows/EmbeddedWindows/Assets/SplashScreen.scale-200.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.71 KB
src/NET_8/EmbeddedWindows/EmbeddedWindows/Assets/Square150x150Logo.scale-200.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+637 Bytes
src/NET_8/EmbeddedWindows/EmbeddedWindows/Assets/Square44x44Logo.scale-200.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+283 Bytes
...ndows/EmbeddedWindows/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.05 KB
src/NET_8/EmbeddedWindows/EmbeddedWindows/Assets/Wide310x150Logo.scale-200.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions
68
src/NET_8/EmbeddedWindows/EmbeddedWindows/EmbeddedWindows.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework> | ||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion> | ||
<OutputType>WinExe</OutputType> | ||
|
||
<!-- WinUI 3 --> | ||
<UseWinUI>true</UseWinUI> | ||
<EnableMsixTooling>true</EnableMsixTooling> | ||
<WindowsPackageType>None</WindowsPackageType> | ||
|
||
<!-- Project Options --> | ||
<Nullable>enable</Nullable> | ||
<!--<ImplicitUsings>enable</ImplicitUsings>--> | ||
<RootNamespace>EmbeddedWindows</RootNamespace> | ||
<EnableDefaultXamlItems>false</EnableDefaultXamlItems> | ||
|
||
<!-- App Options --> | ||
<UseRidGraph>true</UseRidGraph> | ||
<Platforms>x86;x64;arm64</Platforms> | ||
<ApplicationManifest>app.manifest</ApplicationManifest> | ||
<PublishProfile>win10-$(Platform).pubxml</PublishProfile> | ||
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="Assets\SplashScreen.scale-200.png" /> | ||
<Content Include="Assets\LockScreenLogo.scale-200.png" /> | ||
<Content Include="Assets\Square150x150Logo.scale-200.png" /> | ||
<Content Include="Assets\Square44x44Logo.scale-200.png" /> | ||
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" /> | ||
<Content Include="Assets\StoreLogo.png" /> | ||
<Content Include="Assets\Wide310x150Logo.scale-200.png" /> | ||
<!-- Custom Fonts --> | ||
<MauiFont Include="Resources\Fonts\*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" /> | ||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" /> | ||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.*" /> | ||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.*" /> | ||
<Manifest Include="$(ApplicationManifest)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\MauiLib\MauiLib.csproj" /> | ||
</ItemGroup> | ||
|
||
<!-- | ||
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging | ||
Tools extension to be activated for this project even if the Windows App SDK Nuget | ||
package has not yet been restored. | ||
--> | ||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'"> | ||
<ProjectCapability Include="Msix" /> | ||
</ItemGroup> | ||
|
||
<!-- | ||
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution | ||
Explorer "Package and Publish" context menu entry to be enabled for this project even if | ||
the Windows App SDK Nuget package has not yet been restored. | ||
--> | ||
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'"> | ||
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
global using Microsoft.UI.Xaml; | ||
|
||
global using MauiLib; |
48 changes: 48 additions & 0 deletions
48
src/NET_8/EmbeddedWindows/EmbeddedWindows/Package.appxmanifest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="559b8d5a-85a6-462d-8ec8-f49df3a3d69a" | ||
Publisher="CN=User Name" | ||
Version="1.0.0.0" /> | ||
|
||
<Properties> | ||
<DisplayName>EmbeddedWindows</DisplayName> | ||
<PublisherDisplayName>User Name</PublisherDisplayName> | ||
<Logo>Assets\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="EmbeddedWindows" | ||
Description="EmbeddedWindows" | ||
BackgroundColor="transparent" | ||
Square150x150Logo="Assets\Square150x150Logo.png" | ||
Square44x44Logo="Assets\Square44x44Logo.png"> | ||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" /> | ||
<uap:SplashScreen Image="Assets\SplashScreen.png" /> | ||
</uap:VisualElements> | ||
</Application> | ||
</Applications> | ||
|
||
<Capabilities> | ||
<rescap:Capability Name="runFullTrust" /> | ||
</Capabilities> | ||
</Package> |
20 changes: 20 additions & 0 deletions
20
src/NET_8/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-arm64.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<Platform>arm64</Platform> | ||
<RuntimeIdentifier>win10-arm64</RuntimeIdentifier> | ||
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>False</PublishSingleFile> | ||
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun> | ||
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun> | ||
<!-- | ||
See https://github.com/microsoft/CsWinRT/issues/373 | ||
<PublishTrimmed>True</PublishTrimmed> | ||
--> | ||
</PropertyGroup> | ||
</Project> |
20 changes: 20 additions & 0 deletions
20
src/NET_8/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-x64.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<Platform>x64</Platform> | ||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier> | ||
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>False</PublishSingleFile> | ||
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun> | ||
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun> | ||
<!-- | ||
See https://github.com/microsoft/CsWinRT/issues/373 | ||
<PublishTrimmed>True</PublishTrimmed> | ||
--> | ||
</PropertyGroup> | ||
</Project> |
20 changes: 20 additions & 0 deletions
20
src/NET_8/EmbeddedWindows/EmbeddedWindows/Properties/PublishProfiles/win10-x86.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<Platform>x86</Platform> | ||
<RuntimeIdentifier>win10-x86</RuntimeIdentifier> | ||
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>False</PublishSingleFile> | ||
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun> | ||
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun> | ||
<!-- | ||
See https://github.com/microsoft/CsWinRT/issues/373 | ||
<PublishTrimmed>True</PublishTrimmed> | ||
--> | ||
</PropertyGroup> | ||
</Project> |
10 changes: 10 additions & 0 deletions
10
src/NET_8/EmbeddedWindows/EmbeddedWindows/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"profiles": { | ||
"EmbeddedWindows (Package)": { | ||
"commandName": "MsixPackage" | ||
}, | ||
"EmbeddedWindows (Unpackaged)": { | ||
"commandName": "Project" | ||
} | ||
} | ||
} |
Binary file added
BIN
+105 KB
src/NET_8/EmbeddedWindows/EmbeddedWindows/Resources/Fonts/OpenSans-Regular.ttf
Binary file not shown.
Binary file added
BIN
+108 KB
src/NET_8/EmbeddedWindows/EmbeddedWindows/Resources/Fonts/OpenSans-SemiBold.ttf
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
src/NET_8/EmbeddedWindows/EmbeddedWindows/Views/MainWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Window | ||
x:Class="EmbeddedWindows.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:EmbeddedWindows" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d"> | ||
</Window> |
31 changes: 31 additions & 0 deletions
31
src/NET_8/EmbeddedWindows/EmbeddedWindows/Views/MainWindow.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Microsoft.Maui.Hosting; | ||
using Microsoft.Maui.Platform; | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Embedding; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace EmbeddedWindows | ||
{ | ||
/// <summary> | ||
/// An empty window that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
public sealed partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
var mauiApp = MauiApp.CreateBuilder() | ||
.UseMauiEmbedding<MyApp>() | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("OpenSans-Regular.ttf", "OS400"); | ||
fonts.AddFont("OpenSans-SemiBold.ttf", "OS600"); | ||
}) | ||
.Build(); | ||
// While doing .NET MAUI Embedding, this call is required so that the Application object instance gets resolved. | ||
var _ = mauiApp.Services.GetRequiredService<IApplication>(); | ||
Content = new MauiPage().ToPlatform(new MauiContext(mauiApp.Services)); | ||
} | ||
} | ||
} |
Oops, something went wrong.