diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml
index 7bafb20973d..646918f4cd5 100644
--- a/.github/workflows/Build.yml
+++ b/.github/workflows/Build.yml
@@ -37,4 +37,4 @@ jobs:
uses: actions/upload-artifact@v1
with:
name: WPF_Release
- path: ./artifacts/packages/Release/NonShipping
\ No newline at end of file
+ path: ./artifacts/packages/Release/NonShipping
diff --git a/.github/workflows/NuGet-Tag-Publish.yml b/.github/workflows/NuGet-Tag-Publish.yml
new file mode 100644
index 00000000000..7de16267ed3
--- /dev/null
+++ b/.github/workflows/NuGet-Tag-Publish.yml
@@ -0,0 +1,65 @@
+name: Publish Custom WPF
+
+on:
+ push:
+ tags:
+ - '*'
+
+jobs:
+ # BuildDebug:
+
+ # runs-on: windows-latest
+
+ # steps:
+ # - uses: actions/checkout@v1
+ # # - name: Install Nuget
+ # # uses: nuget/setup-nuget@v1
+ # # with:
+ # # nuget-version: '5.x'
+ # - name: Build
+ # run: .\build.cmd -pack -ci -configuration Debug -prepareMachine /p:Platform=x86
+ # - name: Push
+ # uses: actions/upload-artifact@v1
+ # with:
+ # name: WPF_Debug
+ # path: ./artifacts/packages/Debug/NonShipping
+
+ Build:
+
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v1
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: |
+ 3.1.x
+ 5.0.x
+ 6.0.101
+ - name: Install Tools
+ run: dotnet tool install -g dotnetCampus.TagToVersion --add-source https://api.nuget.org/v3/index.json
+ - name: Set Package TagToVersion
+ run: dotnet tagtoversion -t ${{ github.ref }} -f CustomWpf\build\Version.props
+ - name: Build WPF
+ run: .\build.cmd -pack -ci -configuration Release -prepareMachine /p:Platform=x86
+ - name: Pack NuGet
+ run: dotnet pack CustomWpf -c release
+
+ - name: Install Nuget
+ uses: nuget/setup-nuget@v1
+ with:
+ nuget-version: '5.x'
+ - name: Add private GitHub registry to NuGet
+ run: |
+ nuget sources add -name github -Source https://nuget.pkg.github.com/dotnet-campus/index.json -Username dotnet-campus -Password ${{ secrets.GITHUB_TOKEN }}
+ - name: Push NuGet Package
+ run: |
+ nuget push .\CustomWpf\bin\Release\*.nupkg -Source github -SkipDuplicate
+ nuget push .\CustomWpf\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }}
+
+ # - name: Push
+ # uses: actions/upload-artifact@v1
+ # with:
+ # name: WPF_Release
+ # path: ./artifacts/packages/Release/NonShipping
\ No newline at end of file
diff --git a/CustomWpf/CustomWpf.sln b/CustomWpf/CustomWpf.sln
new file mode 100644
index 00000000000..500cb3ff708
--- /dev/null
+++ b/CustomWpf/CustomWpf.sln
@@ -0,0 +1,81 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32014.148
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetCampus.WPF", "Lib\dotnetCampus.CustomWpf.Lib\dotnetCampus.WPF.csproj", "{39764FE3-C2F9-4772-9BF6-B66923ABEC4C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{FE032A91-A790-4274-A194-02E161D1F14B}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packaging", "Packaging", "{27886E90-E328-4AE9-86DA-1F596554D26B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetCampus.WPF.NuGet", "Packaging\dotnetCampus.WPF.NuGet\dotnetCampus.WPF.NuGet.csproj", "{FDC9151F-3544-4C68-9D05-D8E4935F1A9F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetCampus.WPF.Resource", "Lib\dotnetCampus.CustomWpf.Resource\dotnetCampus.WPF.Resource.csproj", "{D73CB485-6290-4E37-B441-8068E60CBF7E}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{315B416C-6CDA-4CD5-9666-69C8272CD80E}"
+ ProjectSection(SolutionItems) = preProject
+ build\Version.props = build\Version.props
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetCampus.WPF.Dependencies", "Lib\dotnetCampus.CustomWpf.Dependencies\dotnetCampus.WPF.Dependencies.csproj", "{39E01A9E-C352-4B7E-96CA-612A07937470}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demo", "Demo", "{1FCB5593-B06F-4DC3-B63F-315CF6DCF2BA}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoApp", "Demo\DemoApp\DemoApp.csproj", "{3C3A4FD6-333B-480B-8354-3BB209FA89DB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoLib1", "Demo\DemoLib1\DemoLib1.csproj", "{B892B53C-752A-4700-8845-CD095F3AC08B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoLib2", "Demo\DemoLib2\DemoLib2.csproj", "{17CCDE40-5335-479A-8B67-E7B0A1332EA9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {39764FE3-C2F9-4772-9BF6-B66923ABEC4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {39764FE3-C2F9-4772-9BF6-B66923ABEC4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {39764FE3-C2F9-4772-9BF6-B66923ABEC4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {39764FE3-C2F9-4772-9BF6-B66923ABEC4C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FDC9151F-3544-4C68-9D05-D8E4935F1A9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FDC9151F-3544-4C68-9D05-D8E4935F1A9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FDC9151F-3544-4C68-9D05-D8E4935F1A9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FDC9151F-3544-4C68-9D05-D8E4935F1A9F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D73CB485-6290-4E37-B441-8068E60CBF7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D73CB485-6290-4E37-B441-8068E60CBF7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D73CB485-6290-4E37-B441-8068E60CBF7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D73CB485-6290-4E37-B441-8068E60CBF7E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {39E01A9E-C352-4B7E-96CA-612A07937470}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {39E01A9E-C352-4B7E-96CA-612A07937470}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {39E01A9E-C352-4B7E-96CA-612A07937470}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {39E01A9E-C352-4B7E-96CA-612A07937470}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3C3A4FD6-333B-480B-8354-3BB209FA89DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3C3A4FD6-333B-480B-8354-3BB209FA89DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3C3A4FD6-333B-480B-8354-3BB209FA89DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3C3A4FD6-333B-480B-8354-3BB209FA89DB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B892B53C-752A-4700-8845-CD095F3AC08B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B892B53C-752A-4700-8845-CD095F3AC08B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B892B53C-752A-4700-8845-CD095F3AC08B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B892B53C-752A-4700-8845-CD095F3AC08B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {17CCDE40-5335-479A-8B67-E7B0A1332EA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {17CCDE40-5335-479A-8B67-E7B0A1332EA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {17CCDE40-5335-479A-8B67-E7B0A1332EA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {17CCDE40-5335-479A-8B67-E7B0A1332EA9}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {39764FE3-C2F9-4772-9BF6-B66923ABEC4C} = {FE032A91-A790-4274-A194-02E161D1F14B}
+ {FDC9151F-3544-4C68-9D05-D8E4935F1A9F} = {27886E90-E328-4AE9-86DA-1F596554D26B}
+ {D73CB485-6290-4E37-B441-8068E60CBF7E} = {FE032A91-A790-4274-A194-02E161D1F14B}
+ {39E01A9E-C352-4B7E-96CA-612A07937470} = {FE032A91-A790-4274-A194-02E161D1F14B}
+ {3C3A4FD6-333B-480B-8354-3BB209FA89DB} = {1FCB5593-B06F-4DC3-B63F-315CF6DCF2BA}
+ {B892B53C-752A-4700-8845-CD095F3AC08B} = {1FCB5593-B06F-4DC3-B63F-315CF6DCF2BA}
+ {17CCDE40-5335-479A-8B67-E7B0A1332EA9} = {1FCB5593-B06F-4DC3-B63F-315CF6DCF2BA}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {C25E6016-F278-457B-87D6-39EC0E0A6849}
+ EndGlobalSection
+EndGlobal
diff --git a/CustomWpf/Demo/DemoApp/App.xaml b/CustomWpf/Demo/DemoApp/App.xaml
new file mode 100644
index 00000000000..d2734c10dbf
--- /dev/null
+++ b/CustomWpf/Demo/DemoApp/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/CustomWpf/Demo/DemoApp/App.xaml.cs b/CustomWpf/Demo/DemoApp/App.xaml.cs
new file mode 100644
index 00000000000..5a67a03ff54
--- /dev/null
+++ b/CustomWpf/Demo/DemoApp/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace DemoApp
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/CustomWpf/Demo/DemoApp/AssemblyInfo.cs b/CustomWpf/Demo/DemoApp/AssemblyInfo.cs
new file mode 100644
index 00000000000..8b5504ecfbb
--- /dev/null
+++ b/CustomWpf/Demo/DemoApp/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/CustomWpf/Demo/DemoApp/DemoApp.csproj b/CustomWpf/Demo/DemoApp/DemoApp.csproj
new file mode 100644
index 00000000000..1a3bf6c44c4
--- /dev/null
+++ b/CustomWpf/Demo/DemoApp/DemoApp.csproj
@@ -0,0 +1,21 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CustomWpf/Demo/DemoApp/MainWindow.xaml b/CustomWpf/Demo/DemoApp/MainWindow.xaml
new file mode 100644
index 00000000000..b52095773ab
--- /dev/null
+++ b/CustomWpf/Demo/DemoApp/MainWindow.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/CustomWpf/Demo/DemoApp/MainWindow.xaml.cs b/CustomWpf/Demo/DemoApp/MainWindow.xaml.cs
new file mode 100644
index 00000000000..d2dfd425734
--- /dev/null
+++ b/CustomWpf/Demo/DemoApp/MainWindow.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace DemoApp
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/CustomWpf/Demo/DemoLib1/AssemblyInfo.cs b/CustomWpf/Demo/DemoLib1/AssemblyInfo.cs
new file mode 100644
index 00000000000..8b5504ecfbb
--- /dev/null
+++ b/CustomWpf/Demo/DemoLib1/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/CustomWpf/Demo/DemoLib1/DemoLib1.csproj b/CustomWpf/Demo/DemoLib1/DemoLib1.csproj
new file mode 100644
index 00000000000..efadcca11bb
--- /dev/null
+++ b/CustomWpf/Demo/DemoLib1/DemoLib1.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CustomWpf/Demo/DemoLib1/UserControl1.xaml b/CustomWpf/Demo/DemoLib1/UserControl1.xaml
new file mode 100644
index 00000000000..c1a99ddd476
--- /dev/null
+++ b/CustomWpf/Demo/DemoLib1/UserControl1.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/CustomWpf/Demo/DemoLib1/UserControl1.xaml.cs b/CustomWpf/Demo/DemoLib1/UserControl1.xaml.cs
new file mode 100644
index 00000000000..255d31e44fa
--- /dev/null
+++ b/CustomWpf/Demo/DemoLib1/UserControl1.xaml.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using DemoLib2;
+
+namespace DemoLib1
+{
+ ///
+ /// Interaction logic for UserControl1.xaml
+ ///
+ public partial class UserControl1 : UserControl
+ {
+ public UserControl1()
+ {
+ InitializeComponent();
+ }
+
+ public Foo Foo { get; } = new Foo();
+ }
+}
diff --git a/CustomWpf/Demo/DemoLib2/DemoLib2.csproj b/CustomWpf/Demo/DemoLib2/DemoLib2.csproj
new file mode 100644
index 00000000000..268cbace460
--- /dev/null
+++ b/CustomWpf/Demo/DemoLib2/DemoLib2.csproj
@@ -0,0 +1,10 @@
+
+
+
+ net6.0
+ enable
+ enable
+ false
+
+
+
diff --git a/CustomWpf/Demo/DemoLib2/Foo.cs b/CustomWpf/Demo/DemoLib2/Foo.cs
new file mode 100644
index 00000000000..a5438636cd7
--- /dev/null
+++ b/CustomWpf/Demo/DemoLib2/Foo.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DemoLib2
+{
+ public class Foo
+ {
+ }
+}
diff --git a/CustomWpf/Directory.Build.props b/CustomWpf/Directory.Build.props
new file mode 100644
index 00000000000..2478d617d14
--- /dev/null
+++ b/CustomWpf/Directory.Build.props
@@ -0,0 +1,18 @@
+
+
+
+ latest
+ $(MSBuildThisFileDirectory)bin\$(Configuration)
+ dotnet campus(.NET 职业技术学院)
+
+ dotnet-campus
+ https://github.com/dotnet-campus/dotnetCampus.CustomWpf
+ https://github.com/dotnet-campus/dotnetCampus.CustomWpf
+ 包含定制的 WPF 版本
+
+ git
+ Copyright © 2020-2022 dotnet campus, All Rights Reserved.
+
+
+
+
diff --git a/CustomWpf/Directory.Build.targets b/CustomWpf/Directory.Build.targets
new file mode 100644
index 00000000000..faf2349bae2
--- /dev/null
+++ b/CustomWpf/Directory.Build.targets
@@ -0,0 +1,3 @@
+
+
+
diff --git a/CustomWpf/Lib/dotnetCampus.CustomWpf.Dependencies/Build/Package.targets b/CustomWpf/Lib/dotnetCampus.CustomWpf.Dependencies/Build/Package.targets
new file mode 100644
index 00000000000..c99690af8b8
--- /dev/null
+++ b/CustomWpf/Lib/dotnetCampus.CustomWpf.Dependencies/Build/Package.targets
@@ -0,0 +1,13 @@
+
+
+
+ $(RuntimeIdentifier)
+ win-x86
+
+
+
+
+
+
+
diff --git a/CustomWpf/Lib/dotnetCampus.CustomWpf.Dependencies/dotnetCampus.WPF.Dependencies.csproj b/CustomWpf/Lib/dotnetCampus.CustomWpf.Dependencies/dotnetCampus.WPF.Dependencies.csproj
new file mode 100644
index 00000000000..63906a8bab0
--- /dev/null
+++ b/CustomWpf/Lib/dotnetCampus.CustomWpf.Dependencies/dotnetCampus.WPF.Dependencies.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net6.0
+
+ false
+ true
+
+
+
+
+
+
+
+
+
+
diff --git a/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/Program.cs b/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/Program.cs
new file mode 100644
index 00000000000..edfa89a0b31
--- /dev/null
+++ b/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/Program.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Runtime.CompilerServices;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Media.Composition;
+using System.Windows.Navigation;
+
+namespace dotnetCampus.WPF
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Application application = new Application();
+ //NavigationService applicationNavService = application.NavService;
+ }
+ }
+}
diff --git a/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnet-campus.PublicKey.snk b/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnet-campus.PublicKey.snk
new file mode 100644
index 00000000000..a21f243aa1b
Binary files /dev/null and b/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnet-campus.PublicKey.snk differ
diff --git a/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnet-campus.snk b/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnet-campus.snk
new file mode 100644
index 00000000000..8251708e309
Binary files /dev/null and b/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnet-campus.snk differ
diff --git a/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnetCampus.WPF.csproj b/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnetCampus.WPF.csproj
new file mode 100644
index 00000000000..5f667bfc3ed
--- /dev/null
+++ b/CustomWpf/Lib/dotnetCampus.CustomWpf.Lib/dotnetCampus.WPF.csproj
@@ -0,0 +1,28 @@
+
+
+
+ net6.0-windows
+ true
+ True
+ dotnet-campus.snk
+
+ ..\..\..\
+
+
+ $(Configuration)
+
+ Microsoft.DotNet.Wpf.GitHub.Debug
+ Microsoft.DotNet.Wpf.GitHub
+
+
+
+ true
+
+ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
+
+
+
+
+
+
diff --git a/CustomWpf/Lib/dotnetCampus.CustomWpf.Resource/Build/Package.props b/CustomWpf/Lib/dotnetCampus.CustomWpf.Resource/Build/Package.props
new file mode 100644
index 00000000000..ca9ef88448a
--- /dev/null
+++ b/CustomWpf/Lib/dotnetCampus.CustomWpf.Resource/Build/Package.props
@@ -0,0 +1,5 @@
+
+
+ $(MSBuildThisFileDirectory)..\Assets\
+
+
diff --git a/CustomWpf/Lib/dotnetCampus.CustomWpf.Resource/dotnetCampus.WPF.Resource.csproj b/CustomWpf/Lib/dotnetCampus.CustomWpf.Resource/dotnetCampus.WPF.Resource.csproj
new file mode 100644
index 00000000000..092ccde4276
--- /dev/null
+++ b/CustomWpf/Lib/dotnetCampus.CustomWpf.Resource/dotnetCampus.WPF.Resource.csproj
@@ -0,0 +1,23 @@
+
+
+
+ net6.0
+ false
+ true
+
+ ..\..\..\
+
+
+ $(Configuration)
+
+ Microsoft.DotNet.Wpf.GitHub.Debug
+ Microsoft.DotNet.Wpf.GitHub
+
+ $(WpfRepoRoot)\artifacts\packaging\$(WpfConfig)\$(WpfOuputFolder)
+
+
+
+
+
+
+
diff --git a/CustomWpf/NuGet.config b/CustomWpf/NuGet.config
new file mode 100644
index 00000000000..f578cf96933
--- /dev/null
+++ b/CustomWpf/NuGet.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/MainTask.cs b/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/MainTask.cs
new file mode 100644
index 00000000000..a528545072c
--- /dev/null
+++ b/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/MainTask.cs
@@ -0,0 +1,64 @@
+using System.Reflection;
+
+using dotnetCampus.Configurations;
+using dotnetCampus.DotNETBuild.Context;
+using dotnetCampus.DotNETBuild.Utils;
+using dotnetCampus.GitCommand;
+
+namespace dotnetCampus.WPF.NuGet;
+
+class MainTask
+{
+ public void Run()
+ {
+ var appConfigurator = AppConfigurator.GetAppConfigurator();
+
+ var commandLineArgs = Environment.GetCommandLineArgs();
+ appConfigurator.AddCommandLine(commandLineArgs, new Dictionary()
+ {
+ {"t","Tag" }
+ });
+
+ var tagVersion = appConfigurator.Default["Tag"];
+
+ FileSniff fileSniff = new FileSniff(appConfigurator);
+ fileSniff.Sniff();
+
+ // 重新寻找 CustomWpf.sln 所在文件夹
+ var slnFolder = FindDirectoryByFile(new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!), "CustomWpf.sln")!;
+
+ var compileConfiguration = appConfigurator.Of();
+
+ Git git = new Git(new DirectoryInfo(compileConfiguration.CodeDirectory));
+ var currentCommit = git.GetCurrentCommit();
+
+ // 找到 Version 版本号文件
+ var versionFile = Path.Combine(slnFolder.FullName, @"build\Version.props");
+
+ }
+
+ ///
+ /// 向上寻找到存在某个文件名的文件夹
+ ///
+ ///
+ ///
+ ///
+ private static DirectoryInfo FindDirectoryByFile(DirectoryInfo currentDirectory, string fileName)
+ {
+ var directory = currentDirectory;
+ while (directory != null)
+ {
+ var file = Path.Combine(directory.FullName, fileName);
+ if (File.Exists(file))
+ {
+ return directory;
+ }
+ else
+ {
+ directory = directory.Parent;
+ }
+ }
+
+ throw new ArgumentException($"Can not find any Directory. CurrentDirectory =\"{currentDirectory}\";FileName=\"{fileName}\"");
+ }
+}
diff --git a/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/Program.cs b/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/Program.cs
new file mode 100644
index 00000000000..d59d2ba2a93
--- /dev/null
+++ b/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/Program.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using dotnetCampus.Configurations;
+using dotnetCampus.DotNETBuild.Utils;
+
+namespace dotnetCampus.WPF.NuGet;
+
+// 这个项目现在完全没有被用上
+// 不删除,后续需要再发布 x64 版本
+internal class Program
+{
+ public static void Main(string[] args)
+ {
+ MainTask mainTask = new MainTask();
+ mainTask.Run();
+ }
+}
diff --git a/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/dotnetCampus.WPF.NuGet.csproj b/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/dotnetCampus.WPF.NuGet.csproj
new file mode 100644
index 00000000000..8b5a0a04d35
--- /dev/null
+++ b/CustomWpf/Packaging/dotnetCampus.WPF.NuGet/dotnetCampus.WPF.NuGet.csproj
@@ -0,0 +1,15 @@
+
+
+
+ Exe
+ net6.0
+ enable
+ enable
+ false
+
+
+
+
+
+
+
diff --git a/CustomWpf/README.md b/CustomWpf/README.md
new file mode 100644
index 00000000000..9864e635efd
--- /dev/null
+++ b/CustomWpf/README.md
@@ -0,0 +1,7 @@
+# 私有发布的 WPF 仓库
+
+这个仓库包含了官方没有合入的功能
+
+## 给开发者
+
+本仓库当前固定 dotnet 版本号,用来解决引用依赖问题。如有升级 dotnet runtime 版本,请同步更改 global.json 的 sdk 版本号,以及 `.github\workflows\` 里面的构建代码的安装版本号
\ No newline at end of file
diff --git a/CustomWpf/build/Version.props b/CustomWpf/build/Version.props
new file mode 100644
index 00000000000..0fd74ea58ea
--- /dev/null
+++ b/CustomWpf/build/Version.props
@@ -0,0 +1,5 @@
+
+
+ 6.0.4-alpha01-202205a6c7dca6
+
+
diff --git a/README.md b/README.md
index abfa3e03b2a..cd2eb0a4310 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,37 @@
+# The Custom Windows Presentation Foundation (WPF)
+
+This repository fork from [WPF](https://github.com/dotnet/wpf), but contains code that is not officially merged.
+
+The reason for creating this repo is that we can't wait for some fascinating features.
+
+
+
+| NuGet | Version |
+|--|--|
+|dotnetCampus.WPF|[](https://www.nuget.org/packages/dotnetCampus.WPF)|
+|dotnetCampus.WPF.Dependencies|[](https://www.nuget.org/packages/dotnetCampus.WPF.Resource)|
+|dotnetCampus.WPF.Resource|[](https://www.nuget.org/packages/dotnetCampus.WPF.Dependencies)|
+
+## What version are we on?
+
+[v6.0.4](https://github.com/dotnet/wpf/releases/tag/v6.0.4)
+
+[fcb07d637abf53791e2c55c63d9207fc3232fe83](https://github.com/dotnet/wpf/commit/fcb07d637abf53791e2c55c63d9207fc3232fe83)
+
+## Features
+
+See [Merged PR Issue #10 dotnet-campus/dotnetCampus.CustomWpf](https://github.com/dotnet-campus/dotnetCampus.CustomWpf/issues/10 )
+
+## Contribution
+
+We recommend that you submit the Pull Request to the official [WPF](https://github.com/dotnet/wpf) repository and then you can ask we to pick the commit to this repository. This repository does not accept commit.
+
+## Reference
+
+- https://github.com/Faithlife/wpf : This is a custom build of Windows Presentation Foundation maintained by Faithlife.
+
+-----
+
# Windows Presentation Foundation (WPF)
[](https://www.dotnetfoundation.org/)
[](https://dnceng.visualstudio.com/public/_build/latest?definitionId=270)
diff --git a/src/Microsoft.DotNet.Wpf/src/Common/src/Interop/Windows/zlib/zlib.cs b/src/Microsoft.DotNet.Wpf/src/Common/src/Interop/Windows/zlib/zlib.cs
index ca6e67a7ad8..fa9aac6717f 100644
--- a/src/Microsoft.DotNet.Wpf/src/Common/src/Interop/Windows/zlib/zlib.cs
+++ b/src/Microsoft.DotNet.Wpf/src/Common/src/Interop/Windows/zlib/zlib.cs
@@ -7,7 +7,7 @@
internal static partial class Interop
{
- internal static partial class zlib
+ internal static partial class Zlib
{
internal static readonly byte[] ZLibVersion = { (byte)'1', (byte)'.', (byte)'2', (byte)'.', (byte)'3', 0 };
[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_DeflateInit2_")]
diff --git a/src/Microsoft.DotNet.Wpf/src/Common/src/System/IO/Compression/DeflateZLib/ZLibNative.cs b/src/Microsoft.DotNet.Wpf/src/Common/src/System/IO/Compression/DeflateZLib/ZLibNative.cs
index 352d9f2248d..5c73688e384 100644
--- a/src/Microsoft.DotNet.Wpf/src/Common/src/System/IO/Compression/DeflateZLib/ZLibNative.cs
+++ b/src/Microsoft.DotNet.Wpf/src/Common/src/System/IO/Compression/DeflateZLib/ZLibNative.cs
@@ -252,7 +252,7 @@ public ErrorCode DeflateInit2_(CompressionLevel level, int windowBits, int memLe
EnsureNotDisposed();
EnsureState(State.NotInitialized);
- ErrorCode errC = Interop.zlib.DeflateInit2_(ref _zStream, level, CompressionMethod.Deflated, windowBits, memLevel, strategy);
+ ErrorCode errC = Interop.Zlib.DeflateInit2_(ref _zStream, level, CompressionMethod.Deflated, windowBits, memLevel, strategy);
_initializationState = State.InitializedForDeflate;
return errC;
@@ -263,7 +263,7 @@ public ErrorCode Deflate(FlushCode flush)
{
EnsureNotDisposed();
EnsureState(State.InitializedForDeflate);
- return Interop.zlib.Deflate(ref _zStream, flush);
+ return Interop.Zlib.Deflate(ref _zStream, flush);
}
@@ -272,7 +272,7 @@ public ErrorCode DeflateEnd()
EnsureNotDisposed();
EnsureState(State.InitializedForDeflate);
- ErrorCode errC = Interop.zlib.DeflateEnd(ref _zStream);
+ ErrorCode errC = Interop.Zlib.DeflateEnd(ref _zStream);
_initializationState = State.Disposed;
return errC;
@@ -284,7 +284,7 @@ public ErrorCode InflateInit2_(int windowBits)
EnsureNotDisposed();
EnsureState(State.NotInitialized);
- ErrorCode errC = Interop.zlib.InflateInit2_(ref _zStream, windowBits);
+ ErrorCode errC = Interop.Zlib.InflateInit2_(ref _zStream, windowBits);
_initializationState = State.InitializedForInflate;
return errC;
@@ -295,7 +295,7 @@ public ErrorCode Inflate(FlushCode flush)
{
EnsureNotDisposed();
EnsureState(State.InitializedForInflate);
- return Interop.zlib.Inflate(ref _zStream, flush);
+ return Interop.Zlib.Inflate(ref _zStream, flush);
}
@@ -304,7 +304,7 @@ public ErrorCode InflateEnd()
EnsureNotDisposed();
EnsureState(State.InitializedForInflate);
- ErrorCode errC = Interop.zlib.InflateEnd(ref _zStream);
+ ErrorCode errC = Interop.Zlib.InflateEnd(ref _zStream);
_initializationState = State.Disposed;
return errC;
diff --git a/src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs b/src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs
index 0ecaad06f94..5b2b5db760a 100644
--- a/src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs
+++ b/src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs
@@ -6,6 +6,8 @@
using System.Resources;
using System.Runtime.CompilerServices;
+[assembly:InternalsVisibleTo("dotnetCampus.WPF, PublicKey=0024000004800000940000000602000000240000525341310004000001000100256f5cb79140dbc25623807d6823ca4b5b602209eaaf71f064e5926a7039c24351c1e2ad3130e194631307ed36a76ad4b832e237a467fefbd693428c7ecc5d4cc26796f6f8b705311948e00f2be5fa2db52ddff50a5b3eb0acc715b45618c1a92532ae2326529fb9e0f58a44abf31e9b5701994464186d3b9f52169b6e0f80b9")]
+
#if WINDOWS_BASE
namespace MS.Internal.WindowsBase
#elif PRESENTATION_CORE
diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.cpp b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.cpp
index 7e9b51adde8..e1c7339e9bc 100644
--- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.cpp
+++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.cpp
@@ -17,17 +17,15 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
// guarantee that this problem will be fixed so we will use the GetUnmanagedStream(). Note: This path will only
// be taken for embedded fonts among which XPS is a main scenario. For local fonts we use DWrite's APIs.
_fontSourceStream = fontSource->GetUnmanagedStream();
+ _fontSourcePointer = _fontSourceStream->PositionPointer - _fontSourceStream->Position;
try
{
_lastWriteTime = fontSource->GetLastWriteTimeUtc().ToFileTimeUtc();
- }
+ }
catch(System::ArgumentOutOfRangeException^) //The resulting file time would represent a date and time before 12:00 midnight January 1, 1601 C.E. UTC.
{
_lastWriteTime = -1;
- }
-
- // Create lock to control access to font source stream.
- _fontSourceStreamLock = gcnew Object();
+ }
}
FontFileStream::~FontFileStream()
@@ -61,31 +59,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
return E_INVALIDARG;
}
- int fragmentSizeInt = (int)fragmentSize;
- array^ buffer = gcnew array(fragmentSizeInt);
-
- // DWrite may call this method from multiple threads. We need to ensure thread safety by making Seek and Read atomic.
- System::Threading::Monitor::Enter(_fontSourceStreamLock);
- try
- {
- _fontSourceStream->Seek(fileOffset, //long
- System::IO::SeekOrigin::Begin);
-
- _fontSourceStream->Read(buffer, //byte[]
- 0, //int
- fragmentSizeInt //int
- );
- }
- finally
- {
- System::Threading::Monitor::Exit(_fontSourceStreamLock);
- }
-
- GCHandle gcHandle = GCHandle::Alloc(buffer, GCHandleType::Pinned);
-
- *fragmentStart = (byte*)(gcHandle.AddrOfPinnedObject().ToPointer());
-
- *fragmentContext = GCHandle::ToIntPtr(gcHandle).ToPointer();
+ // Return a pointer to the font data that is already loaded in memory (because the font source resource is mmapped into the process' address space).
+ *fragmentStart = _fontSourcePointer + fileOffset;
+ *fragmentContext = nullptr;
}
catch(System::Exception^ exception)
{
@@ -102,11 +78,6 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
void* fragmentContext
)
{
- if (fragmentContext != NULL)
- {
- GCHandle gcHandle = GCHandle::FromIntPtr(IntPtr(fragmentContext));
- gcHandle.Free();
- }
}
[ComVisible(true)]
diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.h b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.h
index fa1f3a50c24..49cf479b0b4 100644
--- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.h
+++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFileStream.h
@@ -20,9 +20,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
private ref class FontFileStream : public IDWriteFontFileStreamMirror
{
private:
- Stream^ _fontSourceStream;
+ UnmanagedMemoryStream^ _fontSourceStream;
+ Byte* _fontSourcePointer;
INT64 _lastWriteTime;
- Object^ _fontSourceStreamLock;
public:
diff --git a/src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemCore/DynamicAccessorImpl.cs b/src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemCore/DynamicAccessorImpl.cs
index 7675ce2586b..e68ab97d602 100644
--- a/src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemCore/DynamicAccessorImpl.cs
+++ b/src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemCore/DynamicAccessorImpl.cs
@@ -156,7 +156,7 @@ public static DynamicIndexerAccessor GetIndexerAccessor(int rank)
MulticastDelegate _getterDelegate, _setterDelegate;
static DynamicIndexerAccessor[] _accessors = new DynamicIndexerAccessor[1];
- static object _lock = new object();
+ static readonly object _lock = new object();
}
#endregion DynamicIndexerAccessor
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AnimatedTypeHelpers.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AnimatedTypeHelpers.cs
index 76855e77479..7e7abfb455c 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AnimatedTypeHelpers.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AnimatedTypeHelpers.cs
@@ -844,7 +844,7 @@ internal static Rotation3D GetZeroValueRotation3D(Rotation3D baseValue)
private static Boolean IsInvalidDouble(Double value)
{
return Double.IsInfinity(value)
- || DoubleUtil.IsNaN(value);
+ || double.IsNaN(value);
}
#endregion
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs
index 0ad6a9a7454..35203cd7dae 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs
@@ -499,10 +499,7 @@ private static Text.TextInterface.Font GetFontFromFamily(Text.TextInterface.Font
foreach (KeyValuePair name in font.FaceNames)
{
string currentFontName = name.Value.ToUpper(CultureInfo.InvariantCulture);
- if (!faces.ContainsKey(currentFontName))
- {
- faces.Add(currentFontName, font);
- }
+ faces.TryAdd(currentFontName, font);
}
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheUtil.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheUtil.cs
index f54f8b9dca2..74c9340a7eb 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheUtil.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheUtil.cs
@@ -315,7 +315,7 @@ internal static string CompositeFontExtension
private const string EmptyFontFamilyReference = "#";
private const string EmptyCanonicalName = "";
- private static object _dpiLock = new object();
+ private static readonly object _dpiLock = new object();
private static int _dpi;
private static bool _dpiInitialized = false;
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/TypefaceMetricsCache.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/TypefaceMetricsCache.cs
index 8c5afa842cd..b1ba1f208ee 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/TypefaceMetricsCache.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/TypefaceMetricsCache.cs
@@ -68,7 +68,7 @@ internal static void Add(object key, object value)
}
private static Hashtable _hashTable = new Hashtable(MaxCacheCapacity);
- private static object _lock = new object();
+ private static readonly object _lock = new object();
private const int MaxCacheCapacity = 64; // Maximum cache capacity
}
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/CompositeFontParser.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/CompositeFontParser.cs
index 23aa70f31d8..a92aa59c75f 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/CompositeFontParser.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/CompositeFontParser.cs
@@ -34,7 +34,7 @@ internal class CompositeFontParser
{
internal static void VerifyMultiplierOfEm(string propertyName, ref double value)
{
- if (DoubleUtil.IsNaN(value))
+ if (double.IsNaN(value))
{
throw new ArgumentException(SR.Get(SRID.PropertyValueCannotBeNaN, propertyName));
}
@@ -50,7 +50,7 @@ internal static void VerifyMultiplierOfEm(string propertyName, ref double value)
internal static void VerifyPositiveMultiplierOfEm(string propertyName, ref double value)
{
- if (DoubleUtil.IsNaN(value))
+ if (double.IsNaN(value))
{
throw new ArgumentException(SR.Get(SRID.PropertyValueCannotBeNaN, propertyName));
}
@@ -66,7 +66,7 @@ internal static void VerifyPositiveMultiplierOfEm(string propertyName, ref doubl
internal static void VerifyNonNegativeMultiplierOfEm(string propertyName, ref double value)
{
- if (DoubleUtil.IsNaN(value))
+ if (double.IsNaN(value))
{
throw new ArgumentException(SR.Get(SRID.PropertyValueCannotBeNaN, propertyName));
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/PreloadedPackages.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/PreloadedPackages.cs
index 43faa492ae1..33188884498 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/PreloadedPackages.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/PreloadedPackages.cs
@@ -241,7 +241,7 @@ internal bool ThreadSafe
// Hashtable. HybridDictionary already has functionality of switching between
// ListDictionary and Hashtable depending on the size of the collection
static private HybridDictionary _packagePairs;
- static private Object _globalLock;
+ static private readonly Object _globalLock;
#endregion Private Fields
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs
index ed28449db4c..4dbf871e3ae 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs
@@ -834,7 +834,7 @@ enum RECO_TYPE : ushort
///
/// Used to lock for instancing the native recognizer handle
///
- private static object _syncRoot = new object();
+ private static readonly object _syncRoot = new object();
///
/// All NativeRecognizer share a single handle to the recognizer
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeNode.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeNode.cs
index 56224c40b17..1552dc7978b 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeNode.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeNode.cs
@@ -441,7 +441,6 @@ out bool missingIntersection
{
Rect node1Bounds = _operations.GetNodeBounds(previous._lastNode);
Rect node2Bounds = _operations.GetNodeBounds(_lastNode);
- Rect node3Bounds = _operations.GetNodeBounds(_thisNode);
#if DEBUG_RENDERING_FEEDBACK
if (showFeedback)
{
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/SynchronizedInputHelper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/SynchronizedInputHelper.cs
index 3d020a8e1cc..28cfd0a05ef 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/SynchronizedInputHelper.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/SynchronizedInputHelper.cs
@@ -297,21 +297,18 @@ internal static RoutedEvent[] MapInputTypeToRoutedEvents(SynchronizedInputType i
internal static void RaiseAutomationEvents()
{
- if (InputElement.IsUIElement(InputManager.ListeningElement))
+ if (InputManager.ListeningElement is UIElement e)
{
- UIElement e = (UIElement)InputManager.ListeningElement;
//Raise InputDiscarded automation event
SynchronizedInputHelper.RaiseAutomationEvent(e.GetAutomationPeer());
}
- else if (InputElement.IsContentElement(InputManager.ListeningElement))
+ else if (InputManager.ListeningElement is ContentElement ce)
{
- ContentElement ce = (ContentElement)InputManager.ListeningElement;
//Raise InputDiscarded automation event
SynchronizedInputHelper.RaiseAutomationEvent(ce.GetAutomationPeer());
}
- else if (InputElement.IsUIElement3D(InputManager.ListeningElement))
+ else if (InputManager.ListeningElement is UIElement3D e3D)
{
- UIElement3D e3D = (UIElement3D)InputManager.ListeningElement;
//Raise InputDiscarded automation event
SynchronizedInputHelper.RaiseAutomationEvent(e3D.GetAutomationPeer());
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/FullTextLine.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/FullTextLine.cs
index f0236c6218a..13f66f965cd 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/FullTextLine.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/FullTextLine.cs
@@ -2080,7 +2080,7 @@ public override IList> GetTextRunSpans()
return Array.Empty>();
}
- IList> lsrunList = new List>(2);
+ List> lsrunList = new List>(2);
TextRun lastTextRun = null;
int cchAcc = 0;
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/TextFormatterImp.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/TextFormatterImp.cs
index 160ba8fdc2d..94a4e74de23 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/TextFormatterImp.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/TextFormatterImp.cs
@@ -481,7 +481,7 @@ TextRunCache textRunCache
if (paragraphProperties.DefaultTextRunProperties.Typeface == null)
throw new ArgumentNullException("paragraphProperties.DefaultTextRunProperties.Typeface");
- if (DoubleUtil.IsNaN(paragraphWidth))
+ if (double.IsNaN(paragraphWidth))
throw new ArgumentOutOfRangeException("paragraphWidth", SR.Get(SRID.ParameterValueCannotBeNaN));
if (double.IsInfinity(paragraphWidth))
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/TextRunCacheImp.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/TextRunCacheImp.cs
index ad01bbead6d..18b0a96edcd 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/TextRunCacheImp.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/TextFormatting/TextRunCacheImp.cs
@@ -329,13 +329,13 @@ internal TextSpan GetPrecedingText(TextSour
///
internal IList> GetTextRunSpans()
{
- IList> textRunList = new List>(_textRunVector.Count);
+ TextSpan[] textRunList = new TextSpan[_textRunVector.Count];
- for (int i = 0; i < _textRunVector.Count; i++)
+ for (int i = 0; i < textRunList.Length; i++)
{
- Span currentSpan = _textRunVector[i];
- textRunList.Add(new TextSpan(currentSpan.length, currentSpan.element as TextRun));
- }
+ Span currentSpan = _textRunVector[i];
+ textRunList[i] = new TextSpan(currentSpan.length, currentSpan.element as TextRun);
+ }
return textRunList;
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/UIElementHelper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/UIElementHelper.cs
index 4496a6a014f..b699b840377 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/UIElementHelper.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/UIElementHelper.cs
@@ -141,7 +141,7 @@ internal static DependencyObject GetUIParent(DependencyObject child, bool contin
[FriendAccessAllowed]
internal static bool IsUIElementOrUIElement3D(DependencyObject o)
{
- return (o is UIElement || o is UIElement3D);
+ return (o is UIElement or UIElement3D);
}
[FriendAccessAllowed]
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackageStore.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackageStore.cs
index 0fd55d2fa3e..5fa28c27d67 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackageStore.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackageStore.cs
@@ -172,7 +172,7 @@ private static void ValidatePackageUri(Uri uri)
// Hashtable. HybridDictionary already has functionality of switching between
// ListDictionary and Hashtable depending on the size of the collection
static private HybridDictionary _packages;
- static private Object _globalLock;
+ static private readonly Object _globalLock;
#endregion Private Fields
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/CoreCompatibilityPreferences.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/CoreCompatibilityPreferences.cs
index cfecfb1cdbd..e024c097b6d 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/CoreCompatibilityPreferences.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/CoreCompatibilityPreferences.cs
@@ -187,6 +187,6 @@ private static void Seal()
}
private static bool _isSealed;
- private static object _lockObject = new object();
+ private static readonly object _lockObject = new object();
}
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/DataFormats.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/DataFormats.cs
index 9990b2c9b11..8dd1510fe76 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/DataFormats.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/DataFormats.cs
@@ -470,7 +470,7 @@ private static void EnsurePredefined()
private static ArrayList _formatList;
// This object is for locking the _formatList to access safe in the multi-thread.
- private static Object _formatListlock = new Object();
+ private static readonly Object _formatListlock = new Object();
#endregion Private Fields
}
diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Diagnostics/XamlSourceInfoHelper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Diagnostics/XamlSourceInfoHelper.cs
index 19b30cf6782..e2b53ec2d45 100644
--- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Diagnostics/XamlSourceInfoHelper.cs
+++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Diagnostics/XamlSourceInfoHelper.cs
@@ -38,7 +38,7 @@ internal static class XamlSourceInfoHelper
private static ConditionalWeakTable