Skip to content

Commit

Permalink
Merge pull request #835 from lepoco/development
Browse files Browse the repository at this point in the history
Merge dvelopment
  • Loading branch information
pomianowski committed Nov 22, 2023
2 parents 5ed3786 + e77ea4e commit cc4f708
Show file tree
Hide file tree
Showing 27 changed files with 198 additions and 87 deletions.
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 7.x
- name: Setup .NET Core SDK 8.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
dotnet-version: 8.x

- name: Install docfx
run: dotnet tool update -g docfx
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wpf-ui-cd-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Setup .NET Core SDK 7.x
- name: Setup .NET Core SDK 8.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
dotnet-version: 8.x

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wpf-ui-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v4
- uses: dessant/lock-threads@v5
with:
# https://github.com/dessant/lock-threads
github-token: ${{ github.token }}
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 @@ -19,10 +19,10 @@ jobs:
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Setup .NET Core SDK 7.x
- name: Setup .NET Core SDK 8.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
dotnet-version: 8.x

- name: Install dependencies
run: dotnet restore
Expand Down
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>3.0.0-preview.9</Version>
<LangVersion>11.0</LangVersion>
<Version>3.0.0-preview.10</Version>
<LangVersion>12.0</LangVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>

Expand All @@ -20,7 +20,7 @@
</PropertyGroup>

<PropertyGroup>
<PackagesCommonFrameworks>net7.0-windows;net6.0-windows;net481;net472;net462</PackagesCommonFrameworks>
<PackagesCommonFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net481;net472;net462</PackagesCommonFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
24 changes: 12 additions & 12 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<Project>
<ItemGroup>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageVersion Include="coverlet.collector" Version="3.2.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.VisualStudio.CoreUtility" Version="17.2.3194" />
<PackageVersion Include="Microsoft.VisualStudio.SDK" Version="17.3.32804.24" />
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.4.2118" />
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.1462.37" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.7.2196" />
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2151.40" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
<PackageVersion Include="NativeMethods" Version="0.0.3" />
<PackageVersion Include="NSubstitute" Version="5.0.0" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="PolySharp" Version="1.13.2" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
<PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
<PackageVersion Include="System.Drawing.Common" Version="8.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="WpfAnalyzers" Version="4.1.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageVersion Include="xunit" Version="2.6.2" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Demo.Mvvm/Wpf.Ui.Demo.Mvvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Demo.Simple/Wpf.Ui.Demo.Simple.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
Expand Down
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>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
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 @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui/Appearance/ResourceDictionaryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Wpf.Ui.Appearance;
internal class ResourceDictionaryManager
{
/// <summary>
/// Namespace, e.g. the library the resource is being searched for.
/// Gets the namespace, e.g. the library the resource is being searched for.
/// </summary>
public string SearchNamespace { get; }

Expand Down
8 changes: 4 additions & 4 deletions src/Wpf.Ui/Appearance/SystemTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ public enum SystemTheme
HC2,

/// <summary>
/// First custom, kinda purple Windows 11 theme.
/// Dark theme: Glow
/// </summary>
Glow,

/// <summary>
/// Second custom, kinda red Windows 11 theme.
/// Dark theme: Captured Motion
/// </summary>
CapturedMotion,

/// <summary>
/// Third custom, kinda washed off cyan Windows 11 theme.
/// Light theme: Sunrise
/// </summary>
Sunrise,

/// <summary>
/// Fourth custom, kinda gray Windows 11 theme.
/// Light theme: Flow
/// </summary>
Flow
}
19 changes: 15 additions & 4 deletions src/Wpf.Ui/Appearance/WindowBackgroundManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ namespace Wpf.Ui.Appearance;
/// <summary>
/// Facilitates the management of the window background.
/// </summary>
/// <example>
/// <code lang="csharp">
/// WindowBackgroundManager.UpdateBackground(
/// observedWindow.RootVisual,
/// currentApplicationTheme,
/// observedWindow.Backdrop,
/// observedWindow.ForceBackgroundReplace
/// );
/// </code>
/// </example>
public static class WindowBackgroundManager
{
/// <summary>
Expand Down Expand Up @@ -70,11 +80,12 @@ bool forceBackground
{
backdrop = WindowBackdropType.None;
}
else
{
_ = WindowBackdrop.RemoveBackground(window);
}

// This was required to update the background when moving from a HC theme to light/dark theme. However, this breaks theme proper light/dark theme changing on Windows 10.
// else
// {
// _ = WindowBackdrop.RemoveBackground(window);
// }
_ = WindowBackdrop.ApplyBackdrop(window, backdrop);
if (applicationTheme is ApplicationTheme.Dark)
{
Expand Down
23 changes: 11 additions & 12 deletions src/Wpf.Ui/AutomationPeers/CardControlAutomationPeer.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
// 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.

using System.Windows.Automation;
using System.Windows.Automation.Peers;
using Wpf.Ui.Controls;
Expand All @@ -17,7 +16,7 @@ internal class CardControlAutomationPeer : FrameworkElementAutomationPeer
public CardControlAutomationPeer(CardControl owner)
: base(owner)
{
this._owner = owner;
_owner = owner;
}

protected override string GetClassNameCore()
Expand All @@ -42,7 +41,7 @@ public override object GetPattern(PatternInterface patternInterface)

protected override AutomationPeer GetLabeledByCore()
{
if (this._owner.Header is UIElement element)
if (_owner.Header is UIElement element)
{
return CreatePeerForElement(element);
}
Expand All @@ -52,19 +51,19 @@ protected override AutomationPeer GetLabeledByCore()

protected override string GetNameCore()
{
string result = base.GetNameCore() ?? String.Empty;
var result = base.GetNameCore() ?? String.Empty;

if (result == String.Empty)
{
result = AutomationProperties.GetName(this._owner);
result = AutomationProperties.GetName(_owner);
}

if (result == String.Empty && this._owner.Header is DependencyObject d)
if (result == String.Empty && _owner.Header is DependencyObject d)
{
result = AutomationProperties.GetName(d);
}

if (result == String.Empty && this._owner.Header is string s)
if (result == String.Empty && _owner.Header is string s)
{
result = s;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui/Controls/ContentDialog/ContentDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,13 @@ protected virtual void OnLoaded()
private Size GetNewDialogSize(Size desiredSize)
{
var paddingWidth = Padding.Left + Padding.Right;
var paddingHeight = Padding.Top + Padding.Bottom;

var marginHeight = DialogMargin.Bottom + DialogMargin.Top;
var marginWidth = DialogMargin.Left + DialogMargin.Right;

var width = desiredSize.Width - marginWidth + paddingWidth;
var height = desiredSize.Height - marginHeight;
var height = desiredSize.Height - marginHeight + paddingHeight;

return new Size(width, height);
}
Expand Down
7 changes: 0 additions & 7 deletions src/Wpf.Ui/Controls/TextBlock/TextBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ namespace Wpf.Ui.Controls;
/// </summary>
public class TextBlock : System.Windows.Controls.TextBlock
{
static TextBlock()
{
TextElement
.FontSizeProperty
.OverrideMetadata(typeof(System.Windows.Controls.TextBlock), new FrameworkPropertyMetadata(14.0));
}

/// <summary>
/// Property for <see cref="FontTypography"/>.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui/Controls/TextBlock/TextBlock.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<!-- The Display option causes a large aliasing effect -->
<!--<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />-->
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="Focusable" Value="False" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Standard" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
</Style>
Expand Down
25 changes: 25 additions & 0 deletions src/Wpf.Ui/Converters/IconSourceElementConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,43 @@

namespace Wpf.Ui.Converters;

/// <summary>
/// Converts an <see cref="IconSourceElement"/> to an <see cref="IconElement"/>.
/// </summary>
public class IconSourceElementConverter : IValueConverter
{
/// <summary>
/// Converts a value to an <see cref="IconElement"/>.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <param name="targetType">The type of the binding target property.</param>
/// <param name="parameter">The converter parameter.</param>
/// <param name="culture">The culture to use in the converter.</param>
/// <returns>The converted <see cref="IconElement"/>.</returns>
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return ConvertToIconElement(value);

Check warning on line 26 in src/Wpf.Ui/Converters/IconSourceElementConverter.cs

View workflow job for this annotation

GitHub Actions / deploy

Possible null reference argument for parameter 'value' in 'object IconSourceElementConverter.ConvertToIconElement(object value)'.
}

/// <summary>
/// Converts an <see cref="IconElement"/> back to an IconSourceElement.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <param name="targetType">The type of the binding target property.</param>
/// <param name="parameter">The converter parameter.</param>
/// <param name="culture">The culture to use in the converter.</param>
/// <returns>The converted IconSourceElement.</returns>
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

/// <summary>
/// Converts a value to an <see cref="IconElement"/>.
/// </summary>
/// <param name="_">The dependency object (not used).</param>
/// <param name="baseValue">The base value to convert.</param>
/// <returns>The converted IconElement.</returns>
public static object ConvertToIconElement(DependencyObject _, object baseValue)
{
return ConvertToIconElement(baseValue);
Expand Down
6 changes: 6 additions & 0 deletions src/Wpf.Ui/Extensions/NavigationServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ namespace Wpf.Ui.Extensions;
/// </summary>
public static class NavigationServiceExtensions
{
/// <summary>
/// Sets the pane display mode of the navigation service.
/// </summary>
/// <param name="navigationService">The navigation service.</param>
/// <param name="paneDisplayMode">The pane display mode.</param>
/// <returns>Same <see cref="INavigationService"/> so multiple calls can be chained.</returns>
public static INavigationService SetPaneDisplayMode(
this INavigationService navigationService,
NavigationViewPaneDisplayMode paneDisplayMode
Expand Down
Loading

0 comments on commit cc4f708

Please sign in to comment.