Skip to content

Commit

Permalink
Merge branch 'main' into Feature/SnowflakeEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
pomianowski authored Feb 1, 2025
2 parents 9590103 + 4a32097 commit bd27254
Show file tree
Hide file tree
Showing 70 changed files with 1,424 additions and 695 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WPF UI Docs Dev Container",
"image": "mcr.microsoft.com/dotnet/sdk:8.0",
"image": "mcr.microsoft.com/dotnet/sdk:9.0",
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/top-issues-dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: wpf-ui-top-issues-dashboard
on:
schedule:
- cron: '0 0 */1 * *'

jobs:
ShowAndLabelTopIssues:
name: Display and label top issues.
runs-on: ubuntu-latest
steps:
- name: Top Issues action
uses: rickstaa/[email protected]
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
with:
top_list_size: 10
label: true
dashboard: true
dashboard_show_total_reactions: true
top_issues: true
top_bugs: true
top_features: true
feature_label: feature
top_pull_requests: true
4 changes: 2 additions & 2 deletions .github/workflows/wpf-ui-cd-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Setup .NET Core SDK 8.x
- name: Setup .NET Core SDK 9.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-version: 9.x

- name: Install docfx
run: dotnet tool update -g docfx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wpf-ui-cd-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
paths:
- 'src/Wpf.Ui.Extension**`
- 'src/Wpf.Ui.Extension**'

workflow_dispatch:

Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/wpf-ui-cd-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: wpf-ui-cd-nuget

on:
push:
branches: [main]
branches:
- main
- release/*
paths:
- 'src/**'

workflow_dispatch:

Expand All @@ -17,10 +21,10 @@ jobs:
- uses: nuget/setup-nuget@v2
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Setup .NET Core SDK 8.x
- name: Setup .NET Core SDK 9.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-version: 9.x

- name: Fetch the certificate
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wpf-ui-pr-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- uses: nuget/setup-nuget@v2
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Setup .NET Core SDK 8.x
- name: Setup .NET Core SDK 9.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-version: 9.x

- name: Install dependencies
run: dotnet restore
Expand Down
4 changes: 2 additions & 2 deletions 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-rc.2</Version>
<Version>4.0.0-rc.3</Version>
<AssemblyVersion>4.0.0</AssemblyVersion>
</PropertyGroup>

Expand Down Expand Up @@ -41,7 +41,7 @@

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>12.0</LangVersion>
<LangVersion>13.0</LangVersion>
<Nullable>enable</Nullable>

<!--
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Support the development of WPF UI and other innovative projects by becoming a sp
[Sponsor WPF UI on GitHub](https://github.com/sponsors/lepoco)

## 🚀 Getting started
ąś

For a starter guide see our [documentation](https://wpfui.lepo.co/documentation/).

**WPF UI Gallery** is a free application available in the _Microsoft Store_, with which you can test all functionalities.
Expand Down Expand Up @@ -68,7 +68,7 @@ https://marketplace.visualstudio.com/items?itemName=lepo.wpf-ui

## 📖 Documentation

Documentation can be found at https://wpfui.lepo.co/. We also have a [tutorial](https://wpfui.lepo.co/tutorial/) over there for newcomers.
Documentation can be found at https://wpfui.lepo.co/. We also have a [tutorial](#-getting-started) over there for newcomers.

## 🚧 Development

Expand Down
2 changes: 1 addition & 1 deletion docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ items:
href: documentation/releases.md
- name: API v4.0
href: api/
- name: Suppport plans
- name: Support plans
href: https://lepo.co/support
28 changes: 6 additions & 22 deletions samples/Wpf.Ui.Demo.Mvvm/ViewModels/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ namespace Wpf.Ui.Demo.Mvvm.ViewModels;
public abstract class ViewModel : ObservableObject, INavigationAware
{
/// <inheritdoc />
public virtual async Task OnNavigatedToAsync()
public virtual Task OnNavigatedToAsync()
{
using CancellationTokenSource cts = new();
OnNavigatedTo();

await DispatchAsync(OnNavigatedTo, cts.Token);
return Task.CompletedTask;
}

/// <summary>
Expand All @@ -24,32 +24,16 @@ public virtual async Task OnNavigatedToAsync()
public virtual void OnNavigatedTo() { }

/// <inheritdoc />
public virtual async Task OnNavigatedFromAsync()
public virtual Task OnNavigatedFromAsync()
{
using CancellationTokenSource cts = new();
OnNavigatedFrom();

await DispatchAsync(OnNavigatedFrom, cts.Token);
return Task.CompletedTask;
}

/// <summary>
/// Handles the event that is fired before the component is navigated from.
/// </summary>
// ReSharper disable once MemberCanBeProtected.Global
public virtual void OnNavigatedFrom() { }

/// <summary>
/// Dispatches the specified action on the UI thread.
/// </summary>
/// <param name="action">The action to be dispatched.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
protected static async Task DispatchAsync(Action action, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return;
}

await Application.Current.Dispatcher.InvokeAsync(action);
}
}
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Abstractions/Wpf.Ui.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>WPF-UI.Abstractions</PackageId>
<TargetFrameworks>netstandard2.0;netstandard2.1;net462;net472;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net462;net472;net6.0;net8.0;net9.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Abstractions for the WPF UI.</Description>
<CommonTags>$(CommonTags);abstractions;standard</CommonTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>WPF-UI.DependencyInjection</PackageId>
<TargetFrameworks>netstandard2.0;netstandard2.1;net462;net472;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net462;net472;net6.0;net8.0;net9.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Dependency injection for the WPF UI.</Description>
<CommonTags>$(CommonTags);dependency;injection;abstractions;standard</CommonTags>
Expand All @@ -24,4 +24,4 @@
<ProjectReference Include="..\Wpf.Ui.Abstractions\Wpf.Ui.Abstractions.csproj" />
</ItemGroup>

</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Wpf.Ui.FontMapper/Wpf.Ui.FontMapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Wpf.Ui.Gallery/Models/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class Product

public string? QuantityPerUnit { get; set; }

public Unit Unit { get; set; }

public double UnitPrice { get; set; }

public string UnitPriceString => UnitPrice.ToString("F2");
Expand Down
13 changes: 13 additions & 0 deletions src/Wpf.Ui.Gallery/Models/Unit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

namespace Wpf.Ui.Gallery.Models;

public enum Unit
{
Grams,
Kilograms,
Milliliters
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private static ObservableCollection<Product> GenerateProducts()

var adjectives = new[] { "Red", "Blueberry" };
var names = new[] { "Marmalade", "Dumplings", "Soup" };
/*var units = new[] { "grams", "kilograms", "milliliters" };*/
Unit[] units = [Unit.Grams, Unit.Kilograms, Unit.Milliliters];

for (int i = 0; i < 50; i++)
{
Expand All @@ -32,6 +32,7 @@ private static ObservableCollection<Product> GenerateProducts()
adjectives[random.Next(0, adjectives.Length)]
+ " "
+ names[random.Next(0, names.Length)],
Unit = units[random.Next(0, units.Length)],
UnitPrice = Math.Round(random.NextDouble() * 20.0, 3),
UnitsInStock = random.Next(0, 100),
IsVirtual = random.Next(0, 2) == 1
Expand Down
28 changes: 6 additions & 22 deletions src/Wpf.Ui.Gallery/ViewModels/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ namespace Wpf.Ui.Gallery.ViewModels;
public abstract partial class ViewModel : ObservableObject, INavigationAware
{
/// <inheritdoc />
public virtual async Task OnNavigatedToAsync()
public virtual Task OnNavigatedToAsync()
{
using CancellationTokenSource cts = new();
OnNavigatedTo();

await DispatchAsync(OnNavigatedTo, cts.Token);
return Task.CompletedTask;
}

/// <summary>
Expand All @@ -22,32 +22,16 @@ public virtual async Task OnNavigatedToAsync()
public virtual void OnNavigatedTo() { }

/// <inheritdoc />
public virtual async Task OnNavigatedFromAsync()
public virtual Task OnNavigatedFromAsync()
{
using CancellationTokenSource cts = new();
OnNavigatedFrom();

await DispatchAsync(OnNavigatedFrom, cts.Token);
return Task.CompletedTask;
}

/// <summary>
/// Handles the event that is fired before the component is navigated from.
/// </summary>
// ReSharper disable once MemberCanBeProtected.Global
public virtual void OnNavigatedFrom() { }

/// <summary>
/// Dispatches the specified action on the UI thread.
/// </summary>
/// <param name="action">The action to be dispatched.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
protected static async Task DispatchAsync(Action action, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return;
}

await Application.Current.Dispatcher.InvokeAsync(action);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Grid.Column="1"
Command="{Binding ViewModel.RadioButtonCheckboxCheckedCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:RadioButtonPage}, Mode=OneWay}"
CommandParameter="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay}"
Content="Disable RadioButton's" />
Content="Disable radio buttons" />
</Grid>
</controls:ControlExample>

Expand Down
59 changes: 59 additions & 0 deletions src/Wpf.Ui.Gallery/Views/Windows/SandboxWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,65 @@
<ui:TitleBar.Icon>
<ui:ImageIcon Source="pack://application:,,,/Assets/wpfui.png" />
</ui:TitleBar.Icon>
<ui:TitleBar.Header>
<Menu>
<MenuItem Header="File">
<MenuItem
Header="New" />
<MenuItem
Header="New window" />
<MenuItem
Header="Open..." />
<MenuItem
Header="Save" />
<MenuItem
Header="Save As..." />
<Separator />
<MenuItem
Header="Exit" />
</MenuItem>
<ui:MenuItem Header="Debug">
<MenuItem
Header="Undo" />
<Separator />
<MenuItem
Header="Cut" />
<MenuItem
Header="Copy" />
<MenuItem
Header="Paste" />
<MenuItem
Header="Delete"
IsEnabled="False" />
<Separator />
<MenuItem
Header="Search with browser" />
<MenuItem
Header="Find..." />
<MenuItem
Header="Find next" />
<Separator />
<MenuItem
Header="Select All" />
</ui:MenuItem>
</Menu>
</ui:TitleBar.Header>
<ui:TitleBar.TrailingContent>
<Menu>
<ui:MenuItem
Foreground="{DynamicResource PaletteDeepOrangeBrush}"
Icon="{ui:SymbolIcon Fire24, True}" />
<ui:MenuItem
Foreground="{DynamicResource PaletteGreenBrush}"
Icon="{ui:SymbolIcon Play24}" />
<ui:MenuItem
Foreground="{DynamicResource PaletteRedBrush}"
Icon="{ui:SymbolIcon Stop24}" />
<ui:MenuItem
Foreground="{DynamicResource PaletteLightBlueBrush}"
Icon="{ui:SymbolIcon ArrowClockwise24}" />
</Menu>
</ui:TitleBar.TrailingContent>
</ui:TitleBar>

<StackPanel Margin="24">
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Gallery/Wpf.Ui.Gallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<RootNamespace>Wpf.Ui.Gallery</RootNamespace>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
<UseWPF>true</UseWPF>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
Expand Down
Loading

0 comments on commit bd27254

Please sign in to comment.