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

Initial implementation of WinUI with samples and features working #853

Merged
merged 16 commits into from
Jan 11, 2025
Merged
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
Prev Previous commit
Next Next commit
Update project settings, clean up code, and improve docs
Updated README.md to reflect changes in description and package details. Modified `MessageDialogResult.cs` to use `_content` and `_title`. Updated `App.xaml` and `App.xaml.cs` with XML declaration, removed comments, and added navigation to `MenuView`. Updated `Features.WinUI3.csproj` to target .NET 8.0 and adjusted settings. Cleaned up `RootView.xaml.cs` and other files by removing unused directives. Updated `Package.appxmanifest` and `app.manifest` for Windows 10 compatibility. Renamed bindings in `ActionsView.xaml`, `NavigationSourceView.xaml`, and `NavigationTargetView.xaml`. Updated `Microsoft.NET.Test.Sdk` and `Nerdbank.GitVersioning` packages. Improved formatting and consistency in several files. Added strong name key files.
vb2ae committed Dec 17, 2024
commit 6303d22bf8ea741e1801f1c20ecae3e41f9471a9
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -8,20 +8,20 @@ MyGet | [![MyGet Package](https://img.shields.io/myget/caliburn-micro-builds/v/c
NuGet | [![NuGet Package](https://img.shields.io/nuget/v/Caliburn.Micro.svg?logo=nuget&logoColor=white&&style=for-the-badge&colorB=green)](https://www.nuget.org/packages/Caliburn.Micro)
GitHub Action | ![example workflow](https://github.com/Caliburn-Micro/Caliburn.Micro/actions/workflows/dotnet.yml/badge.svg)

Caliburn.Micro is a small, yet powerful framework, designed for building applications across all XAML platforms. With strong support for MVVM and other proven UI patterns, Caliburn.Micro will enable you to build your solution quickly, without the need to sacrifice code quality or testability.
Caliburn.Micro is a small, yet powerful framework, designed for building applications across all XAML platforms. With strong support for MVVM and other proven UI patterns, Caliburn.Micro enables you to build your solution quickly without sacrificing code quality or testability.

## Packages are available on Nuget
- [Caliburn.Micro.Core](https://www.nuget.org/packages/Caliburn.Micro.Core/) - The Portable Class Library (PCL) portion of Caliburn.Micro.
- [Caliburn.Micro.Core](https://www.nuget.org/packages/Caliburn.Micro.Core/) - The Standard Class Library portion of Caliburn.Micro.
- [Caliburn.Micro](https://www.nuget.org/packages/Caliburn.Micro/) - The platform-specific adapters for Caliburn.Micro.
- [Caliburn.Micro.Xamarin.Forms](https://www.nuget.org/packages/Caliburn.Micro.Xamarin.Forms/) - Support to Caliburn.Micro in Xamarin.Forms.

## Packages are available on Github
- [Caliburn.Micro.Core](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Core) - The Portable Class Library (PCL) portion of Caliburn.Micro.
- [Caliburn.Micro.Core](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Core) - The Standard Class Library portion of Caliburn.Micro.
- [Caliburn.Micro](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro) - The platform-specific adapters for Caliburn.Micro.
- [Caliburn.Micro.Xamarin.Forms](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Xamarin.Forms) - Support to Caliburn.Micro for Xamarin.Forms.
- [Caliburn.Micro.Maui](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Maui) - Support to Caliburn.Micro for dotnet Maui
- [Caliburn.Micro.Avalonia](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Avalonia) - Support To Caliburn.Micro for Avalonia UI
- [Caliburn.Micro.WinUI]() - Support to Caliburn.Micro for WinUI (WinApp Sdk) Coming Soon
- [Caliburn.Micro.WinUI]() - Support to Caliburn.Micro for WinUI (WinApp Sdk)

## Questions
- For non bug related questions see [Stack Overflow](https://stackoverflow.com/questions/tagged/caliburn.micro)
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ public override async void Execute(CoroutineExecutionContext context)
#elif WinUI3
public override async void Execute(CoroutineExecutionContext context)
{
var dialog = new MessageDialog(content, title);
var dialog = new MessageDialog(_content, _title);

var hWnd = GetActiveWindow();

4 changes: 1 addition & 3 deletions samples/features/Features.WinUI3/App.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->

<?xml version="1.0" encoding="utf-8"?>
<cal:CaliburnApplication
x:Class="Features.WinUI3.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
38 changes: 6 additions & 32 deletions samples/features/Features.WinUI3/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.UI.Xaml.Shapes;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Caliburn.Micro;
using Features.CrossPlatform.ViewModels;
using Windows.UI.Core;
using Windows.UI.Popups;
using Features.CrossPlatform.Views;
using System.Reflection.Metadata;
using Features.WinUI3.Views;
using Microsoft.UI.Xaml.Media.Animation;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Windows.ApplicationModel.Activation;
using Windows.UI.Popups;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
@@ -70,14 +52,6 @@ protected override void Configure()
protected override void PrepareViewFirst(Frame rootFrame)
{
var navigationService = container.RegisterNavigationService(rootFrame);
//var navigationManager = SystemNavigationManager.GetForCurrentView();

//navigationService.Navigated += (s, e) =>
//{
// navigationManager.AppViewBackButtonVisibility = navigationService.CanGoBack ?
// AppViewBackButtonVisibility.Visible :
// AppViewBackButtonVisibility.Collapsed;
//};
}

protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
@@ -125,7 +99,7 @@ public void DisplayRootNavigationView()
InitializeWindow();
PrepareViewFirst();


RootFrame.Navigate(typeof(MenuView), null);

var root = new RootView(RootFrame);
152 changes: 27 additions & 125 deletions samples/features/Features.WinUI3/Features.WinUI3.csproj
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Features.WinUI3</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<DefineConstants>WinUI3</DefineConstants>
<EnableMsixTooling>true</EnableMsixTooling>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Remove="Views\ActionsView.xaml" />
<None Remove="Views\Activity\MessageActivityView.xaml" />
<None Remove="Views\Activity\PhotoActivityView.xaml" />
<None Remove="Views\BindingsView.xaml" />
<None Remove="Views\BubblingView.xaml" />
<None Remove="Views\ConductorView.xaml" />
<None Remove="Views\CoroutineView.xaml" />
<None Remove="Views\DesignTimeView.xaml" />
<None Remove="Views\EventAggregationView.xaml" />
<None Remove="Views\Events\EventDestinationView.xaml" />
<None Remove="Views\Events\EventSourceView.xaml" />
<None Remove="Views\ExecuteView.xaml" />
<None Remove="Views\FeatureView.xaml" />
<None Remove="Views\MenuView.xaml" />
<None Remove="Views\NavigationSourceView.xaml" />
<None Remove="Views\NavigationTargetView.xaml" />
<None Remove="Views\RootView.xaml" />
<None Remove="Views\TabView.xaml" />
</ItemGroup>

<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
@@ -44,128 +25,49 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
<Manifest Include="$(ApplicationManifest)" />
</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>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
</ItemGroup>
<ItemGroup>
<Reference Include="Caliburn.Micro.Core">
<HintPath>..\..\..\bin\Caliburn.Micro.WinUI3\release\net6.0-windows10.0.19041.0\Caliburn.Micro.Core.dll</HintPath>
<HintPath>..\..\..\bin\Caliburn.Micro.WinUI3\release\net8.0-windows10.0.19041.0\Caliburn.Micro.Core.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform.Core">
<HintPath>..\..\..\bin\Caliburn.Micro.WinUI3\release\net6.0-windows10.0.19041.0\Caliburn.Micro.Platform.Core.dll</HintPath>
<HintPath>..\..\..\bin\Caliburn.Micro.WinUI3\release\net8.0-windows10.0.19041.0\Caliburn.Micro.Platform.Core.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.WinUI3">
<HintPath>..\..\..\bin\Caliburn.Micro.WinUI3\release\net6.0-windows10.0.19041.0\Caliburn.Micro.WinUI3.dll</HintPath>
<HintPath>..\..\..\bin\Caliburn.Micro.WinUI3\release\net8.0-windows10.0.19041.0\Caliburn.Micro.WinUI3.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Page Update="Views\RootView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\Activity\MessageActivityView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\Events\EventDestinationView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\ActionsView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\BindingsView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\BubblingView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\ConductorView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\CoroutineView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\DesignTimeView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\EventAggregationView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\NavigationSourceView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\FeatureView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\NavigationTargetView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\TabView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\ExecuteView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\MenuView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\Events\EventSourceView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Views\Activity\PhotoActivityView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>

<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
<!--
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>

<!-- Publish Properties -->
<PropertyGroup>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
</PropertyGroup>
<Import Project="..\Features.CrossPlatform.Shared\Features.CrossPlatform.Shared.projitems" Label="Shared" />
</Project>
</Project>

This file was deleted.

7 changes: 3 additions & 4 deletions samples/features/Features.WinUI3/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->

<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="Features.WinUI3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Features.WinUI3"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
mc:Ignorable="d"
Title="Features.WinUI3">

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
3 changes: 0 additions & 3 deletions samples/features/Features.WinUI3/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.Collections.Generic;
using System.IO;
9 changes: 6 additions & 3 deletions samples/features/Features.WinUI3/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -2,18 +2,21 @@

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
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="110b564b-8576-4261-9f89-7f0bb671b7d9"
Publisher="CN=ksk"
Name="3b0eec3a-fcea-4542-8223-9e0119f74452"
Publisher="CN=vb2ae"
Version="1.0.0.0" />

<mp:PhoneIdentity PhoneProductId="3b0eec3a-fcea-4542-8223-9e0119f74452" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

<Properties>
<DisplayName>Features.WinUI3</DisplayName>
<PublisherDisplayName>ksk</PublisherDisplayName>
<PublisherDisplayName>vb2ae</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>

4 changes: 2 additions & 2 deletions samples/features/Features.WinUI3/Views/ActionsView.xaml
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
<Run Text="{Binding Output}"/>
</TextBlock>

<TextBox Header="Name" x:Name="Name" Margin="0,10,0,0" Width="600" HorizontalAlignment="Left"/>
<TextBox Header="Name" x:Name="UserName" Margin="0,10,0,0" Width="600" HorizontalAlignment="Left"/>

<Button x:Name="Clear" Content="Clear" Style="{StaticResource ActionButtonStyle}"/>
<Button x:Name="SimpleSayHello" Content="Simple Say Hello" Style="{StaticResource ActionButtonStyle}"/>
@@ -43,7 +43,7 @@
</i:Interaction.Behaviors>
</Button>
<Button x:Name="SayHello" Content="Say Hello (with parameter)" Style="{StaticResource ActionButtonStyle}"/>
<Button cal:Message.Attach="SayHello(Name)" Content="Say Hello (with parameter and Message.Attach)" Style="{StaticResource ActionButtonStyle}"/>
<Button cal:Message.Attach="SayHello(UserName)" Content="Say Hello (with parameter and Message.Attach)" Style="{StaticResource ActionButtonStyle}"/>
<Button x:Name="SayGoodbye" Content="Say Goodbye (async method)" Style="{StaticResource ActionButtonStyle}"/>
</StackPanel>
</StackPanel>
1 change: 0 additions & 1 deletion samples/features/Features.WinUI3/Views/BindingsView.xaml
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<StackPanel>
<TextBlock Text="bindings" Style="{StaticResource SubheaderTextBlockStyle}" Margin="40,10,40,0"/>
<ListView x:Name="Activities" Padding="40,20">
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
<TextBlock Text="navigation" Style="{StaticResource SubheaderTextBlockStyle}" Margin="40,10,40,0"/>
<StackPanel Margin="40,20">
<TextBox Header="Text" x:Name="Text" />
<CheckBox x:Name="IsEnabled" Content="Is Enabled" />
<CheckBox x:Name="IsNavigationEnabled" Content="Is Enabled" />
<Button x:Name="Navigate" Content="Navigate" />
</StackPanel>
</StackPanel>
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
<TextBlock Text="navigation" Style="{StaticResource SubheaderTextBlockStyle}" Margin="40,10,40,0"/>
<StackPanel Margin="40,20">
<TextBlock x:Name="Text" Style="{StaticResource BodyTextBlockStyle}" />
<TextBlock x:Name="IsEnabled" Style="{StaticResource BodyTextBlockStyle}" />
<TextBlock x:Name="IsNavigationEnabled" Style="{StaticResource BodyTextBlockStyle}" />
</StackPanel>
</StackPanel>
</Page>
Loading