Skip to content

Commit

Permalink
Merge branch 'main' into datagrid-issues-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pomianowski authored Jan 22, 2025
2 parents 01aacf9 + 397739b commit ec981ae
Show file tree
Hide file tree
Showing 22 changed files with 158 additions and 33 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
6 changes: 4 additions & 2 deletions .github/workflows/wpf-ui-cd-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: wpf-ui-cd-nuget
on:
push:
branches: [main]
paths:
- 'src/**'

workflow_dispatch:

Expand All @@ -17,10 +19,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
2 changes: 1 addition & 1 deletion 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
19 changes: 8 additions & 11 deletions docs/documentation/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

## Adding dictionaries

[XAML](https://docs.microsoft.com/en-us/dotnet/desktop/wpf/xaml/?view=netdesktop-6.0), and hence WPF, operate on resource dictionaries. These are HTML-like files that describe the appearance and various aspects of the [controls](https://wpfui.lepo.co/documentation/controls).
**WPF UI** adds its own sets of these files to tell the application how the controls should look like.
[XAML](https://docs.microsoft.com/en-us/dotnet/desktop/wpf/xaml/?view=netdesktop-6.0), and hence WPF, operate on resource dictionaries. These are HTML-like files that describe the appearance and various aspects of the [controls](https://wpfui.lepo.co/documentation/controls). **WPF UI** adds its own sets of these files to tell the application how the controls should look.

There should be a file called `App.xaml` in your new application. Add new dictionaries to it using **WPF UI** `ControlsDictionary` and `ThemesDictionary` classes:

Expand All @@ -20,16 +19,13 @@ There should be a file called `App.xaml` in your new application. Add new dictio
</ResourceDictionary>
</Application.Resources>
</Application>

```

You can choose a color theme here,
`Light` or `Dark`.
Notice that the `ThemeDictionary` lets you choose a color theme, `Light` or `Dark`.

## The main window

There should be a `MainWindow.xaml` file in your newly created application.
It contains the arrangement of the controls used and their parameters.
There should be a `MainWindow.xaml` file in your newly created application. It contains the arrangement of the controls used and their parameters.

```xml
<Window x:Class="WpfApp1.MainWindow"
Expand All @@ -46,7 +42,7 @@ It contains the arrangement of the controls used and their parameters.
</Window>
```

You can add a new namespace to this window to tell the interpreter that you will be using controls from somewhere, like the **WPF UI** library.
Add the **WPF UI** library namespace to this window to tell the XAML compiler that you will be using controls from the library.

```xml
<Window
Expand All @@ -56,7 +52,7 @@ You can add a new namespace to this window to tell the interpreter that you will

## Adding controls

To add a new control from the **WPF UI** library, you just need to enter its class name, prefixing it with the `ui:` prefix:
To add a new control from the **WPF UI** library, just enter its class name, prefixing it with the `ui:` prefix:

```xml
<Window x:Class="WpfApp1.MainWindow"
Expand All @@ -76,5 +72,6 @@ To add a new control from the **WPF UI** library, you just need to enter its cla

# Well...

That's it when it comes to the basics, information about individual controls can be found in [documentation](https://wpfui.lepo.co/documentation/), rules for building a WPF application can be found in the [official Microsoft documentation](https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/styles-templates-overview?view=netdesktop-6.0). You can check out [**how to build MVVM applications** here](https://learn.microsoft.com/en-us/windows/communitytoolkit/mvvm/puttingthingstogether).
If you think this documentation sucks, [help improve it here](https://github.com/lepoco/wpfui/tree/development/docs/tutorial).
That's it when it comes to the basics, information about individual controls can be found in [documentation](https://wpfui.lepo.co/documentation/). Rules for building a WPF application can be found in the [official Microsoft documentation](https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/styles-templates-overview?view=netdesktop-6.0). You can check out [**how to build MVVM applications** here](https://learn.microsoft.com/en-us/windows/communitytoolkit/mvvm/puttingthingstogether).

If you think this documentation needs improvement, please [help improve it here](https://github.com/lepoco/wpfui/tree/development/docs/tutorial).
88 changes: 88 additions & 0 deletions docs/documentation/system-theme-watcher.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# SystemThemeWatcher

SystemThemeWatcher automatically updates the application background if the system theme or color changes. This component is used to adapt the application's background effect and theme according to the system theme.

## Features

* Automatic Theme Updates: Updates the application's background and theme when the system theme changes.

* Global Settings: Settings apply globally and cannot be changed for each System.Windows.Window.

* Supported Backdrop Types: Provides background effects compatible with WindowBackdropType types (e.g., Egg).


## Usage

You can use SystemThemeWatcher to start watching a window's background and theme like this:

```cs
SystemThemeWatcher.Watch(this as System.Windows.Window);
SystemThemeWatcher.UnWatch(this as System.Windows.Window);
```

or
```cs
SystemThemeWatcher.Watch(
_serviceProvider.GetRequiredService<MainWindow>()
);
```

## Example Usage

Here's an example of using SystemThemeWatcher in the MainWindow class to start watching the theme when the window is loaded:

```cs
namespace MyApp;

public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

Loaded += (sender, args) =>
{
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(
this, // Window class
Wpf.Ui.Controls.WindowBackdropType.Mica, // Background type
true // Whether to change accents automatically
);
};
}
}
```

## Methods

### Watch

Applies the background effect and theme according to the system theme to the observed window.

```cs
public static void Watch(
Window? window,
WindowBackdropType backdrop = WindowBackdropType.Mica,
bool updateAccents = true
)
```

### UnWatch

Stops watching the window and removes the hook to receive system messages.

```cs
public static void UnWatch(Window? window)

```

### WndProc

Listens to system messages on the application windows.

```cs
private static IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)

```

> [!IMPORTANT]
> If UnWatch is called on a window that has not yet loaded, an InvalidOperationException may occur. Ensure that the window is loaded before calling UnWatch.
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: 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
2 changes: 1 addition & 1 deletion src/Wpf.Ui.SyntaxHighlight/Wpf.Ui.SyntaxHighlight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>WPF-UI.SyntaxHighlight</PackageId>
<TargetFrameworks>net462;net472;net481;net6.0-windows;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net472;net481;net6.0-windows;net8.0-windows;net9.0-windows</TargetFrameworks>
<Description>Native tast notification support for WPF using the WPF UI library.</Description>
<CommonTags>$(CommonTags);syntax;highlight</CommonTags>
<UseWPF>true</UseWPF>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>WPF-UI.ToastNotifications</PackageId>
<TargetFrameworks>net462;net472;net481;net6.0-windows;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net472;net481;net6.0-windows;net8.0-windows;net9.0-windows</TargetFrameworks>
<Description>Native tast notification support for WPF using the WPF UI library.</Description>
<CommonTags>$(CommonTags);toast;notifications</CommonTags>
<UseWPF>true</UseWPF>
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Tray/Wpf.Ui.Tray.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>WPF-UI.Tray</PackageId>
<TargetFrameworks>net462;net472;net481;net6.0-windows;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net472;net481;net6.0-windows;net8.0-windows;net9.0-windows</TargetFrameworks>
<Description>Native tray menu icon support for WPF using the WPF UI library.</Description>
<CommonTags>$(CommonTags);tray;notifyicon;notify</CommonTags>
<UseWPF>true</UseWPF>
Expand Down
2 changes: 2 additions & 0 deletions src/Wpf.Ui/Controls/MessageBox/MessageBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,12 @@ public bool IsPrimaryButtonEnabled
/// </summary>
public IRelayCommand TemplateButtonCommand => (IRelayCommand)GetValue(TemplateButtonCommandProperty);

#if !NET8_0_OR_GREATER
private static readonly PropertyInfo CanCenterOverWPFOwnerPropertyInfo = typeof(Window).GetProperty(
"CanCenterOverWPFOwner",
BindingFlags.NonPublic | BindingFlags.Instance
)!;
#endif

/// <summary>
/// Initializes a new instance of the <see cref="MessageBox"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,23 @@ protected override void OnMouseDown(MouseButtonEventArgs e)
if (e.ChangedButton is MouseButton.XButton1 or MouseButton.XButton2)
{
e.Handled = true;
return;
}

base.OnMouseDown(e);
}

protected override void OnPreviewKeyDown(KeyEventArgs e)
{
if (e.Key == Key.F5)
{
e.Handled = true;
return;
}

base.OnPreviewKeyDown(e);
}

protected virtual void OnNavigating(System.Windows.Navigation.NavigatingCancelEventArgs eventArgs)
{
NotifyContentAboutNavigatingTo(eventArgs.Content);
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui/Wpf.Ui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>WPF-UI</PackageId>
<TargetFrameworks>net462;net472;net481;net6.0-windows;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net472;net481;net6.0-windows;net8.0-windows;net9.0-windows</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.</Description>
<UseWPF>true</UseWPF>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion tests/Wpf.Ui.UnitTests/Wpf.Ui.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down

0 comments on commit ec981ae

Please sign in to comment.