Skip to content

Commit

Permalink
Bump version, add migration instructions for WPF UI v3 and v4 and upd…
Browse files Browse the repository at this point in the history
…ate package configuration (#1353)
  • Loading branch information
pomianowski authored Feb 18, 2025
1 parent a8917ca commit 75aa3f8
Show file tree
Hide file tree
Showing 22 changed files with 259 additions and 116 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<PropertyGroup>
<Version>4.0.0</Version>
<Version>4.0.1</Version>
<AssemblyVersion>4.0.0</AssemblyVersion>
</PropertyGroup>

Expand Down
96 changes: 30 additions & 66 deletions Wpf.Ui.sln

Large diffs are not rendered by default.

94 changes: 94 additions & 0 deletions docs/migration/v2-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Migration plan

This page outlines key changes and important details to consider when migrating. It highlights what’s new, what’s changed, and any steps you need to take to ensure a smooth transition. This isn’t a full step-by-step guide but a quick reference to help you navigate the most critical parts of the migration process.

## Key changes in v2

### Global namespace change

In version 2.0 the namespace has been changed from `WPF-UI` to the more .NET compatible `Wpf.Ui`. The package name has not been changed to maintain branding and consistency.

### Navigation

The navigation control has been rewritten yet again, making it almost completely incompatible.

All navigation controls inherit from `Wpf.Ui.Controls.Navigation.NavigationBase` base class.

```xml
<ui:NavigationStore
Frame="{Binding ElementName=RootFrame}"
Precache="False"
SelectedPageIndex="-1"
TransitionDuration="200"
TransitionType="FadeInWithSlide">
<ui:NavigationStore.Items>
<ui:NavigationItem
Cache="True"
Content="Home"
Icon="Home24"
PageTag="dashboard"
PageType="{x:Type pages:Dashboard}" />
<ui:NavigationSeparator />
</ui:NavigationStore.Items>
<ui:NavigationStore.Footer>
<ui:NavigationItem
Click="NavigationButtonTheme_OnClick"
Content="Theme"
Icon="DarkTheme24" />
</ui:NavigationStore.Footer>
</ui:NavigationStore>
```

```xml
<ui:NavigationFluent
Frame="{Binding ElementName=RootFrame}"
Precache="False"
SelectedPageIndex="-1"
TransitionDuration="200"
TransitionType="FadeInWithSlide">
<ui:NavigationFluent.Items>
<ui:NavigationItem
Cache="True"
Content="Home"
Icon="Home24"
PageTag="dashboard"
PageType="{x:Type pages:Dashboard}" />
<ui:NavigationSeparator />
</ui:NavigationFluent.Items>
<ui:NavigationFluent.Footer>
<ui:NavigationItem
Click="NavigationButtonTheme_OnClick"
Content="Theme"
Icon="DarkTheme24" />
</ui:NavigationFluent.Footer>
</ui:NavigationFluent>
```

```xml
<ui:NavigationCompact
Frame="{Binding ElementName=RootFrame}"
Precache="False"
SelectedPageIndex="-1"
TransitionDuration="200"
TransitionType="FadeInWithSlide">
<ui:NavigationCompact.Items>
<ui:NavigationItem
Cache="True"
Content="Home"
Icon="Home24"
PageTag="dashboard"
PageType="{x:Type pages:Dashboard}" />
<ui:NavigationSeparator />
</ui:NavigationCompact.Items>
<ui:NavigationCompact.Footer>
<ui:NavigationItem
Click="NavigationButtonTheme_OnClick"
Content="Theme"
Icon="DarkTheme24" />
</ui:NavigationCompact.Footer>
</ui:NavigationCompact>
```

### Titlebar

The titlebar control has been rewritten yet again, making it almost completely incompatible.
19 changes: 19 additions & 0 deletions docs/migration/v3-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Migration plan

This page outlines key changes and important details to consider when migrating. It highlights what’s new, what’s changed, and any steps you need to take to ensure a smooth transition. This isn’t a full step-by-step guide but a quick reference to help you navigate the most critical parts of the migration process.

## Navigation

All navigation controls have been merged into one `NavigationView`, inspired by Win UI.

## Icons

All icons are based on the new `IconElement` control. They replaced icons in `TitleBar`, `NavigationView`, `Button` and other controls.

## Control Gallery

Inspired by **Win UI Controls Gallery**, a new application for testing and browsing controls was created -** WPF UI Gallery**. It replaced the Demo app.

## Dialogs

`ContentDialog`, `MessageBox` and `Snackbar` have been modified, their interfaces are not fully compatible.
45 changes: 45 additions & 0 deletions docs/migration/v4-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Migration plan

This page outlines key changes and important details to consider when migrating. It highlights what’s new, what’s changed, and any steps you need to take to ensure a smooth transition. This isn’t a full step-by-step guide but a quick reference to help you navigate the most critical parts of the migration process.

## Abstractions package

Some WPF UI interfaces have been moved to a standalone package **WPF-UI.Abstractions**. You don't need to reference it, it will always be added automatically with **WPF-UI** NuGet package.

## Navigation interfaces

Navigation interfaces have been moved to a standalone **WPF-UI.Abstractions** package. This way, if you have models, views or other business services in another project, not related to WPF, you can develop them together for multiple applications.

### New namespaces

`INavigationAware` and `INavigableView` have beed moved to `Wpf.Ui.Abstractions.Controls` namespace.

### Dependency injection based page creation

`IPageService` have been renamed to `INavigationViewPageProvider`.

Its default implementation is in the new **Wpf.Ui.DependencyInjection** package. You just need to use the `services.AddNavigationViewPageProvider()` extension and then indicate in the navigation that you want to use this interface. Then `NavigationView` will use DI container for pages creation.

**Program.cs**
```csharp
var builder = Host.CreateDefaultBuilder();
builder.Services.AddNavigationViewPageProvider();
```

**MyWindow.xaml.cs**
```csharp
var pageProvider = serviceProvider.GetRequiredService<INavigationViewPageProvider>();

// NavigationControl is x:Name of our NavigationView defined in XAML.
NavigationControl.SetPageProviderService(pageProvider)
```

### Navigation service

The `INavigationService` defined in the main package (**WPF-UI**) makes navigation management easy. You can use it for convenient injection between view models. We **HIGHLY** recommend it to be Singleton.

```csharp
var builder = Host.CreateDefaultBuilder();
builder.Services.AddNavigationViewPageProvider();
builder.Services.AddSingleton<INavigationService, NavigationService>();
```
9 changes: 9 additions & 0 deletions docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,14 @@ items:
href: documentation/releases.md
- name: API v4.0
href: api/
- name: Migration
href: /migration
items:
- name: Key changes in v4
href: migration/v4-migration.md
- name: Key changes in v3
href: migration/v3-migration.md
- name: Key changes in v2
href: migration/v2-migration.md
- name: Support plans
href: https://lepo.co/support
3 changes: 1 addition & 2 deletions samples/Wpf.Ui.Demo.Dialogs/Wpf.Ui.Demo.Dialogs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>applicationIcon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms>
<NoWarn>$(NoWarn);SA1601</NoWarn>
</PropertyGroup>

Expand Down
3 changes: 1 addition & 2 deletions samples/Wpf.Ui.Demo.Mvvm/Wpf.Ui.Demo.Mvvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>applicationIcon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms>
<NoWarn>$(NoWarn);SA1601</NoWarn>
</PropertyGroup>

Expand Down
3 changes: 1 addition & 2 deletions samples/Wpf.Ui.Demo.Simple/Wpf.Ui.Demo.Simple.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>applicationIcon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms>
<NoWarn>$(NoWarn);SA1601</NoWarn>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui.Extension.Template.Blank/Wpf.Ui.Blank.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WPF-UI" Version="4.0.0" />
<PackageReference Include="WPF-UI" Version="4.0.1" />
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0 "/>
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Wpf.Ui.Extension.Template.Compact/Wpf.Ui.Compact.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WPF-UI" Version="4.0.0" />
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.0" />
<PackageReference Include="WPF-UI" Version="4.0.1" />
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0 "/>
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Wpf.Ui.Extension.Template.Fluent/Wpf.Ui.Fluent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WPF-UI" Version="4.0.0" />
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.0" />
<PackageReference Include="WPF-UI" Version="4.0.1" />
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0 "/>
</ItemGroup>
Expand Down
43 changes: 27 additions & 16 deletions src/Wpf.Ui.Gallery.Package/Wpf.Ui.Gallery.Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,13 @@
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<ProjectConfiguration Include="Debug|arm64">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
<Platform>arm64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<ProjectConfiguration Include="Release|arm64">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
<Platform>arm64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|AnyCPU">
<Configuration>Debug</Configuration>
Expand All @@ -51,18 +43,37 @@
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>50c713c3-555e-491f-87ee-c806bec0579f</ProjectGuid>
<TargetPlatformVersion>10.0.22621.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.14393.0</TargetPlatformMinVersion>
<TargetPlatformVersion>10.0.26100.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<NoWarn>$(NoWarn);NU1701;NU1702</NoWarn>
<EntryPointProjectUniqueName>..\Wpf.Ui.Gallery\Wpf.Ui.Gallery.csproj</EntryPointProjectUniqueName>
<GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundlePlatforms>x86</AppxBundlePlatforms>
<AppxBundlePlatforms>x86|x64|arm64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm64'">
<AppxBundle>Always</AppxBundle>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
Expand Down
4 changes: 3 additions & 1 deletion src/Wpf.Ui.Gallery/Controllers/MonacoController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void DispatchScript(string script)
return;
}

_ = Application.Current.Dispatcher.InvokeAsync(async () => await _webView!.ExecuteScriptAsync(script));
_ = Application.Current.Dispatcher.InvokeAsync(
async () => await _webView!.ExecuteScriptAsync(script)
);
}
}
8 changes: 4 additions & 4 deletions src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
</ui:CardAction.Icon>
<StackPanel>
<ui:TextBlock
FontSize="16"
FontTypography="BodyStrong"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Text="{Binding Name, Mode=OneTime}"
TextWrapping="Wrap"
FontSize="16"/>
TextWrapping="Wrap" />
<ui:TextBlock
Appearance="Secondary"
FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Text="{Binding Description, Mode=OneTime}"
TextWrapping="Wrap"
FontSize="12"/>
TextWrapping="Wrap" />
</StackPanel>
</ui:CardAction>
</DataTemplate>
Expand Down
5 changes: 3 additions & 2 deletions src/Wpf.Ui.Gallery/Wpf.Ui.Gallery.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Wpf.Ui.Gallery</RootNamespace>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
<UseWPF>true</UseWPF>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<ApplicationIcon>wpfui.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<NoWarn>$(NoWarn);SA1601</NoWarn>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Platforms>AnyCPU;x86;x64;arm64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui/Controls/Arc/Arc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ static Arc()
// Modify the metadata of the StrokeStartLineCap dependency property.
StrokeStartLineCapProperty.OverrideMetadata(
typeof(Arc),
new PropertyMetadata(PenLineCap.Round, PropertyChangedCallback));
new PropertyMetadata(PenLineCap.Round, PropertyChangedCallback)
);
}

/// <summary>
Expand Down
Loading

0 comments on commit 75aa3f8

Please sign in to comment.