ShortDev.Uwp.FullTrust
Create a performant WinUI application with Uwp and CoreWindow and run as full-trust win32
Install / Use
/learn @ShortDevelopment/ShortDev.Uwp.FullTrustREADME
ShortDev.Uwp.FullTrust
Create highly performant UI with WinUi2 (Uwp) and enjoy the freedom of Win32!
You don't need any interop code for the .GetForCurrentView() methods.
Problems
- The library does currently not support any Uwp-Frame related apis
- Therefore not frame customization
- Creating a new window is only possible with the library apis
- Pickers still need
IInitializeWithWindow(See #11)
Setup
- Create new Uwp project (UI-Project)
- Add
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>in to the project file - Add reference to this library
- Create new
netcoreapp3.1WinExeproject (Host-Project) - Add reference to
Microsoft.Toolkit.Win32.UI.SDK - Add reference to Uwp project
- Add
TargetPlatformVersionandAssetTargetFallbackto the project file - Redirect main method to the Uwp main method (See below)
Host-Project (netcoreapp3.1)
This is needed for the management of all the dependency and runtime stuff.
Should contain no logic.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Platforms>x86;x64</Platforms>
<AssetTargetFallback>uap10.0.19041</AssetTargetFallback>
<TargetPlatformVersion>10.0.19041</TargetPlatformVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Win32.UI.SDK" Version="6.1.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="<PATH_TO_UWP_PROJECT>" />
</ItemGroup>
</Project>
Program.cs
public class Program
{
[STAThread]
public static void Main(string[] args)
{
NAMESPACE.Program.Main(args);
}
}
UI-Project (Uwp)
Should contain all logic.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
</PropertyGroup>
...
</Project>
Program.cs
public class Program
{
[STAThread]
public static void Main(string[] args)
{
FullTrustApplication.Start((_) => new App());
}
}
Examples
Create New Window
var view = FullTrustApplication.CreateNewView();
_ = view.CoreWindow.Dispatcher.RunIdleAsync((x) =>
{
Window.Current.Content = new MainPage();
Window.Current.Activate();
});
Related Skills
node-connect
333.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
333.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.0kCommit, push, and open a PR
