### Install specific Microsoft.WindowsDesktop.App runtime versions with dotnet-install.ps1 Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Use the dotnet-install.ps1 script to install both 32-bit and 64-bit versions of the Microsoft.WindowsDesktop.App runtime into the specified folders. Pass "Latest" to get the latest version. This script can also install the SDK. ```powershell $dotnet_install = "$env:TEMP\dotnet-install.ps1" $x64InstallDir = "$env:ProgramFiles\dotnet" $x86InstallDir = "${env:ProgramFiles(x86)}\dotnet" Invoke-WebRequest https://dot.net/v1/dotnet-install.ps1 -OutFile $dotnet_install .$dotnet_install -Channel master -Version 3.0.0-preview5-27619-18 -Runtime windowsdesktop -Architecture x64 -InstallDir $x64InstallDir .$dotnet_install -Channel master -Version 3.0.0-preview5-27619-18 -Runtime windowsdesktop -Architecture x86 -InstallDir $x86InstallDir ``` -------------------------------- ### Test WPF template with dotnet new install, uninstall, and wpf -n testapp1 Source: https://github.com/dotnet/wpf/blob/main/packaging/Microsoft.Dotnet.Wpf.ProjectTemplates/readme.MD These commands are part of the template testing workflow: install the WPF Application (C#) template, verify it is installed, create a test app, and uninstall the template to revert. The install and uninstall commands use the path to the repository's WpfApplication-CSharp content folder. ```shell > dotnet new install \wpf\packaging\Microsoft.Dotnet.Wpf.ProjectTemplates\content\WpfApplication-CSharp ``` ```shell > dotnet new uninstall ``` ```shell > dotnet new wpf -n testapp1 ``` ```shell > dotnet new uninstall \wpf\packaging\Microsoft.Dotnet.Wpf.ProjectTemplates\content\WpfApplication-CSharp ``` -------------------------------- ### Command line for wc.exe with /lines and /files options Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/readme.txt Example command line that sets lines to true and files to an array containing "foo" and "bar". ```text wc.exe /lines /files:foo /files:bar ``` -------------------------------- ### Find Microsoft.WindowsDesktop.App version in Microsoft.NETCoreSdk.BundledVersions.props Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Shows the KnownFrameworkReference entry in Microsoft.NETCoreSdk.BundledVersions.props that maps an SDK version to the associated Microsoft.WindowsDesktop.App version. In this example, the version is 3.0.0-preview4-27613-28. ```xml ``` -------------------------------- ### csproj with wpf-debug.targets import Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Example csproj configuration for debugging locally built WPF assemblies. Append the Import line to the project file and set WpfRepoRoot to the repository root. The default PlatformTarget is x64, while the default repo build is x86, so build with -plat x64 or set PlatformTarget to x86 to avoid binary mismatch. ```xml WinExe net11.0-windows true C:\wpf ``` -------------------------------- ### Configure 1ES Pipeline Template with Multiple Outputs Source: https://github.com/dotnet/wpf/blob/main/eng/common/template-guidance.md Example of using the 1ES pipeline template with multiple outputs to reduce security scan overhead. This configuration requires publishing artifacts to the Build.ArtifactStagingDirectory. ```yaml # azure-pipelines.yml extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: stages: - stage: build jobs: - template: /eng/common/templates-official/jobs/jobs.yml@self parameters: # 1ES makes use of outputs to reduce security task injection overhead templateContext: outputs: - output: pipelineArtifact displayName: 'Publish logs from source' continueOnError: true condition: always() targetPath: $(Build.ArtifactStagingDirectory)/artifacts/log artifactName: Logs jobs: - job: Windows steps: - script: echo "friendly neighborhood" > artifacts/marvel/spiderman.txt # copy build outputs to artifact staging directory for publishing - task: CopyFiles@2 displayName: Gather build output inputs: SourceFolder: '$(System.DefaultWorkingDirectory)/artifacts/marvel' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/marvel' ``` -------------------------------- ### ContentTextAutomationPeer.RaiseActiveTextPositionChangedEvent Method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Raises an ActiveTextPositionChanged event. The rangeStart parameter is the start of the range that changed; it must be a valid TextPointer for the peer's owner, or null to denote the start of the owner's text content. The rangeEnd parameter is the end of the range that changed; it must be a valid TextPointer for the peer's owner, or null to denote the end of the owner's text content. ```csharp public virtual void RaiseActiveTextPositionChangedEvent(TextPointer rangeStart, TextPointer rangeEnd); ``` -------------------------------- ### Correct T4 helper function with Output prefix Source: https://github.com/dotnet/wpf/blob/main/Documentation/codegen.md Shows a T4 helper function that starts with 'Output' and does not impose extra indentation, making it reusable. ```text <#+ void OutputFooFunction() { #> bool GetFoo() { ... } <#+ } #> ``` -------------------------------- ### Incorrect T4 helper function without Output prefix Source: https://github.com/dotnet/wpf/blob/main/Documentation/codegen.md Shows a T4 helper function that does not start with 'Output' and adds extra indentation, making it harder to reuse. ```text <#+ void FooFunction() { #> bool GetFoo() { ... } <#+ } #> ``` -------------------------------- ### NotificationProcessing property Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the order in which to process the notification. Returns one of the AutomationNotificationProcessing values. ```csharp public AutomationNotificationProcessing NotificationProcessing { get; } ``` -------------------------------- ### Enable local markup compilation with InternalMarkupCompilation Source: https://github.com/dotnet/wpf/blob/main/Documentation/LocalMarkupCompilation.md Enable local markup compilation by setting InternalMarkupCompilation to true. Optionally set NoInternalTypeHelper and GenerateDependencyFile to false to avoid internal type helper generation and dependency file generation. See PresentationUI.csproj for an example. ```xml true ``` ```xml true false ``` -------------------------------- ### ContentElementAutomationPeer.GetHeadingLevelCore Method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Override of GetHeadingLevelCore for ContentElementAutomationPeer. Called by GetHeadingLevel() to get the heading level of the associated ContentElement. ```csharp protected override AutomationHeadingLevel GetHeadingLevelCore(); ``` -------------------------------- ### NotificationEventArgs.DisplayString Property Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the display string of the notification. This property is read-only and returns a string describing the event. ```csharp public string DisplayString { get; } ``` -------------------------------- ### Add to .csproj to fix NETSDK1083 Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Add the tag to your .csproj file to resolve the NETSDK1083 error. For x86 builds, set the value to x86. The example shows a complete PropertyGroup with OutputType, TargetFramework, UseWPF, and PlatformTarget, plus a second PropertyGroup defining WpfRepoRoot and an Import of the wpf-debug.targets file. ```xml WinExe net6.0-windows true x86 C:\wpf ``` -------------------------------- ### NotificationKind property Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the type of the notification. Returns one of the AutomationNotificationKind values. ```csharp public AutomationNotificationKind NotificationKind { get; } ``` -------------------------------- ### LINK error C1047 compiler version mismatch Source: https://github.com/dotnet/wpf/wiki/Building-WPF-Locally Example error message when local build fails due to a compiler version mismatch. This occurs because LTCG and WholeProgramOptimization require all libraries to be compiled with the same compiler; some libs come from an internal repo built with a different MSVC version. ```text LINK(0,0): error C1047: (NETCORE_ENGINEERING_TELEMETRY=Build) The object or library file 'D:\a\_work\1\s\.packages\runtime.win-x64.microsoft.dotnet.wpf.dnceng\6.0.0-rtm.22161.2\runtimes\win-x64\native\bilinearspan.lib' was created by a different version of the compiler than other objects like 'D:\a\_work\1\s\artifacts\obj\wpfgfx\x64\Release\precomp.obj'; rebuild all objects and libraries with the same compiler ``` -------------------------------- ### ActiveTextPositionChangedEventArgs.TextRange Property Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the text range where the change occurred, or null to indicate the entire content of the text provider. ```csharp public ITextRangeProvider TextRange { get; } ``` -------------------------------- ### AutomationProperties.GetIsDialog(DependencyObject) Method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the AutomationProperties.IsDialog attached property value for the specified DependencyObject. Returns true if the element is identified as a dialog window; otherwise, false. ```csharp public static bool GetIsDialog(System.Windows.DependencyObject element); ``` -------------------------------- ### Create and run a new WPF application with dotnet new Source: https://github.com/dotnet/wpf/blob/main/Documentation/getting-started.md Use these commands in a console to create a new WPF application named MyWPFApp, navigate into it, and run it. Requires the .NET SDK (6.0 recommended or 7.0 daily build). ```cmd dotnet new wpf -o MyWPFApp cd MyWPFApp dotnet run ``` -------------------------------- ### Build WPF locally with build.cmd for x64 release Source: https://github.com/dotnet/wpf/wiki/Building-WPF-Locally Command to build WPF locally for x64 platform and release configuration. Use -c for configuration and -plat for platform. ```shell ./build.cmd -c release -plat x64 ``` -------------------------------- ### Packaging file layout Source: https://github.com/dotnet/wpf/blob/main/Documentation/packaging.md Shows the directory structure of the packaging folder and the relevant props/targets files. ```text $(WpfArcadeSdkToolsDir)\Packaging.props $(WpfArcadeSdkToolsDir)\Packaging.targets $(RepoRoot)\packaging\**\* │ ├───Microsoft.DotNet.Arcade.Wpf.Sdk │ Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral.csproj │ ├───Microsoft.DotNet.Wpf.DncEng │ Microsoft.DotNet.Wpf.DncEng.ArchNeutral.csproj │ Microsoft.DotNet.Wpf.DncEng.csproj │ └───Microsoft.DotNet.Wpf.GitHub Microsoft.DotNet.Wpf.GitHub.ArchNeutral.csproj Microsoft.DotNet.Wpf.GitHub.csproj ``` -------------------------------- ### Run Csp tests with build.cmd Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/WpfGfx/tools/csp/README.md Run the Csp unit tests from the root of the WPF repository. This command invokes the build script with the specified project file. ```text build.cmd -projects "src\Microsoft.DotNet.Wpf\src\WpfGfx\tools\csp\RunUnitTests.proj" ``` -------------------------------- ### Opting into a package with PackageName property Source: https://github.com/dotnet/wpf/blob/main/Documentation/packaging.md Shows how an assembly opts into a package by setting the PackageName property in Packaging.props. ```xml $(DncEngTransportPackageName) ``` -------------------------------- ### AutomationProperties.HeadingLevel Attached Property Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets or sets a value that indicates the heading level for an element. The attached property is accessed via GetHeadingLevel and SetHeadingLevel methods. ```csharp see GetHeadingLevel, and SetHeadingLevel ``` -------------------------------- ### C# runtimeclass MyExample API signature Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/0spec_template.md Shows the public API surface for a runtime class named MyExample. It includes a read-write property, a read-only property, and a method. This is intended as a signature form without implementation details. ```csharp runtimeclass MyExample { int PropertyOne { get; set; } string PropertyTwo { get; private set; } void MethodOne(); } ``` -------------------------------- ### NotificationEventArgs.ActivityId Property Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the activity ID string of the notification. This property is read-only and returns a unique non-localized string to identify an action or group of actions. ```csharp public string ActivityId { get; } ``` -------------------------------- ### WPF assembly output tree for net472 and netcoreapp2.1 Source: https://github.com/dotnet/wpf/blob/main/Documentation/projects-and-assemblies.md Shows the assembly layout for the WPF project, listing the DLLs and PDBs produced for the net472 and netcoreapp2.1 target frameworks, including satellite resource assemblies for each supported culture. ```text +---net472 | | PresentationBuildTasks.dll | | System.Collections.Immutable.dll | | System.Memory.dll | | System.Numerics.Vectors.dll | | System.Reflection.Metadata.dll | | System.Reflection.MetadataLoadContext.dll | | System.Runtime.CompilerServices.Unsafe.dll | | | +---cs | | PresentationBuildTasks.resources.dll | | | +---de | | PresentationBuildTasks.resources.dll | | | +---es | | PresentationBuildTasks.resources.dll | | | +---fr | | PresentationBuildTasks.resources.dll | | | +---it | | PresentationBuildTasks.resources.dll | | | +---ja | | PresentationBuildTasks.resources.dll | | | +---ko | | PresentationBuildTasks.resources.dll | | | +---pl | | PresentationBuildTasks.resources.dll | | | +---pt-BR | | PresentationBuildTasks.resources.dll | | | +---ru | | PresentationBuildTasks.resources.dll | | | +---tr | | PresentationBuildTasks.resources.dll | | | +---zh-Hans | | PresentationBuildTasks.resources.dll | | | \---zh-Hant | PresentationBuildTasks.resources.dll | \---netcoreapp2.1 | PresentationBuildTasks.dll | System.Reflection.MetadataLoadContext.dll | +---cs | PresentationBuildTasks.resources.dll | +---de | PresentationBuildTasks.resources.dll | +---es | PresentationBuildTasks.resources.dll | +---fr | PresentationBuildTasks.resources.dll | +---it | PresentationBuildTasks.resources.dll | +---ja | PresentationBuildTasks.resources.dll | +---ko | PresentationBuildTasks.resources.dll | +---pl | PresentationBuildTasks.resources.dll | +---pt-BR | PresentationBuildTasks.resources.dll | +---ru | PresentationBuildTasks.resources.dll | +---tr | PresentationBuildTasks.resources.dll | +---zh-Hans | PresentationBuildTasks.resources.dll | \---zh-Hant PresentationBuildTasks.resources.dll ``` -------------------------------- ### Incorrect multi-line T4 code block Source: https://github.com/dotnet/wpf/blob/main/Documentation/codegen.md Shows the discouraged formatting where the <# and #> tags are on the same line as the code, making it harder to identify the start and end of the block. ```text <# string helloWorld = " Hello World "; helloWorld = helloWorld.Trim(); #> <#= hellowWorld #> ``` -------------------------------- ### Files for renaming and packaging Source: https://github.com/dotnet/wpf/blob/main/Documentation/redistributables.md Lists the files used to orchestrate the renaming of DLL import tables, copying of renamed assemblies, and packaging them. ```text eng\WpfArcadeSdk\Redist.props eng\WpfArcadeSdk\Redist.targets src\Microsoft.DotNet.Wpf\redist\**\* ``` -------------------------------- ### Using SystemColors accent color brushes Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Shows how to use accent color brushes without the Fluent theme by referencing resource keys defined in the SystemColors class. Use Light1, Light2, and Light3 variations for Dark mode and Dark1, Dark2, and Dark3 for light mode when using AccentColor APIs directly. ```xml ``` -------------------------------- ### Specify Microsoft.WindowsDesktop.App runtime version in project file Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Add this to your project file to test your application against a specific version of the Microsoft.WindowsDesktop.App shared runtime when building from source. The version is set via the MicrosoftWindowsDesktopAppVersion property. ```xml 3.0.0-preview5-27619-18 $(MicrosoftWindowsDesktopAppVersion) ``` -------------------------------- ### Reference local WPF binaries in project file Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Use this project file snippet to reference locally built WPF assemblies when testing API changes. Set WpfRepoRoot to your local repo path, WpfConfig to the build configuration (Release/Debug), and WpfOuputFolder to the output folder name. SelfContained must be true and RuntimeIdentifier must match the architecture you built for, e.g., win-x86. ```xml d:\dev\src\dotnet\wpf Debug Microsoft.DotNet.Wpf.GitHub.Debug true win-x86 ``` -------------------------------- ### Enable Fluent theme via ResourceDictionary in App.xaml or Window XAML Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Include the Fluent theme ResourceDictionary in App.xaml to enable the theme for the whole application, or in a Window's XAML to enable it for that window only. The dictionary source is pack://application:,,,/PresentationFramework.Fluent;component/Themes/Fluent.xaml. By default, the theme reacts to system theme changes. ```xml ``` ```xml ``` -------------------------------- ### Force Fluent Light or Dark mode with Fluent.Light.xaml / Fluent.Dark.xaml Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Include these dictionaries to force Light or Dark mode instead of reacting to system theme changes. Use Fluent.Light.xaml for Light mode and Fluent.Dark.xaml for Dark mode. ```xml ``` -------------------------------- ### ToolTipService and ToolTip API Surface Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/tooltip.md New public API surface for ToolTipService and ToolTip classes, including properties for keyboard focus support. ```c# class ToolTipService { public static DependencyProperty ShowsToolTipOnKeyboardFocusProperty; public static bool? GetShowsToolTipOnKeyboardFocus(DependencyObject d); public static void SetShowsToolTipOnKeyboardFocus(DependencyObject d, bool? value); } class ToolTip { public bool? ShowsToolTipOnKeyboardFocus { get; set; } } ``` -------------------------------- ### MSBuild imports for design-time T4 templates Source: https://github.com/dotnet/wpf/blob/main/Documentation/codegen.md Shows the required imports to enable design-time T4 templates in an SDK-style project. The Sdk.targets must be imported manually before the T4 targets to ensure the TransformAll target runs before Build. ```xml ``` -------------------------------- ### Zlib license notice (zlib.h) Source: https://github.com/dotnet/wpf/blob/main/THIRD-PARTY-NOTICES.TXT Zlib license notice for version 1.2.11, January 15th, 2017. It grants permission to use, modify, and redistribute the software, including commercial applications, with three conditions: acknowledgment in product documentation is appreciated but not required, altered source versions must be marked, and the notice must not be removed. ```c /* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.11, January 15th, 2017 Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. ``` -------------------------------- ### Update runtimeconfig.json to use specific Microsoft.WindowsDesktop.App version Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Update the *.runtimeconfig.json file next to the executable to pick up a specific version of the Microsoft.WindowsDesktop.App runtime when you cannot build from source. ```json { "runtimeOptions": { "tfm": "netcoreapp3.0", "framework": { "name": "Microsoft.WindowsDesktop.App", "version": "3.0.0-preview5-27619-18" } } } ``` -------------------------------- ### ToolTipService.ShowsToolTipOnKeyboardFocus Accessors Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/tooltip.md Reference to the getter and setter methods for the ToolTipService.ShowsToolTipOnKeyboardFocus attached property. ```text see GetShowsToolTipOnKeyboardFocus, and SetShowsToolTipOnKeyboardFocus ``` -------------------------------- ### Usage message for wc.exe with unrecognized argument -x Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/readme.txt Usage message displayed when an unrecognized argument is passed. Shows the recognized options and their short forms. ```text wc.exe -x Unrecognized command line argument '-x' /lines[+|-] short form /l /words[+|-] short form /w /chars[+|-] short form /c @ Read response file for more options ``` -------------------------------- ### Redistributable assemblies list Source: https://github.com/dotnet/wpf/blob/main/Documentation/redistributables.md Lists the two redistributable assemblies that are bundled with WPF on .NET Core: vcruntime140.dll and d3dcompiler_47.dll. ```text - vcruntime140.dll - d3dcompiler_47.dll ``` -------------------------------- ### Parse wc command line arguments with Utilities.Utility.ParseCommandLineArguments Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/readme.txt Defines a WCArguments class with boolean fields for lines, words, and chars, plus a string array for files. The Main method calls ParseCommandLineArguments and, on failure, prints the usage message via CommandLineArgumentsUsage. ```csharp class WCArguments { public bool lines; public bool words; public bool chars; public string[] files; } class WC { static void Main(string[] args) { WCArguments parsedArgs = new WCArguments(); if (!Utilities.Utility.ParseCommandLineArguments(args, parsedArgs)) { // error encountered in arguments. Display usage message System.Console.Write(Utilities.Utility.CommandLineArgumentsUsage(typeof(WCArguments))); } else { // insert application code here } } } ``` -------------------------------- ### Create XmlSchemaSet from embedded XSD resources Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/ReachFramework/Resources/documentation.txt Use this snippet to create a validating XML reader from the generated schema resources. It loads the 'rdkey.xsd' and 's0schema.xsd' resources from the assembly, adds them to an XmlSchemaSet, compiles the set, and releases the resources. The method returns the compiled XmlSchemaSet for use in validation. ```csharp private XmlSchemaSet GetXmlSchemaSet() { ResourceManager resourceManager = new ResourceManager( "Schemas_S0", Assembly.GetExecutingAssembly()); byte [] rdkey = (byte[])resourceManager.GetObject("rdkey.xsd"); byte [] s0 = (byte[])resourceManager.GetObject("s0schema.xsd"); XmlSchemaSet xss = new XmlSchemaSet(); xss.Add(null, new XmlTextReader(new MemoryStream(rdkey))); xss.Add(null, new XmlTextReader(new MemoryStream(s0))); xss.Compile(); resourceManager.ReleaseAllResources(); return xss; } ``` -------------------------------- ### ToolTip.ShowsToolTipOnKeyboardFocus Property Definition Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/tooltip.md The property definition for the ShowsToolTipOnKeyboardFocus property on the ToolTip element. ```csharp public bool? ShowsToolTipOnKeyboardFocus { get; set; } ``` -------------------------------- ### Set ThemeMode from code-behind Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Sets the ThemeMode property from code-behind after suppressing the WPF0001 warning. Assigns Light to the Application and System to a Window. ```cs // Sets Fluent theme on Application level Application.Current.ThemeMode = ThemeMode.Light; // Sets Fluent theme on one Window window.ThemeMode = ThemeMode.System; ``` -------------------------------- ### New Automation API Surface (C#) Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md The complete new public API surface for the automation update, including enums, properties, events, and peer overrides. Use this as a reference when implementing or consuming the new automation features. ```csharp namespace System.Windows.Automation { public enum AutomationHeadingLevel { None, Level1, Level2, Level3, Level4, Level5, Level6, Level7, Level8, Level9 } public enum AutomationNotificationKind { ItemAdded, ItemRemoved, ActionCompleted, ActionAborted, Other } public enum AutomationNotificationProcessing { ImportantAll, ImportantMostRecent, All, MostRecent, CurrentThenMostRecent } public class AutomationProperties { public static readonly DependencyProperty HeadingLevelProperty; public static AutomationHeadingLevel GetHeadingLevel(DependencyObject element); public static void SetHeadingLevel(DependencyObject element, AutomationHeadingLevel value); public static readonly DependencyProperty IsDialogProperty; public static bool GetHeadingLevel(DependencyObject element); public static void SetIsDialog(DependencyObject element, bool value); } public class AutomationElement { public static readonly AutomationProperty HeadingLevelProperty; public static readonly AutomationProperty IsDialogProperty; public static readonly AutomationEvent NotificationEvent; public static readonly AutomationEvent ActiveTextPositionChangedEvent; } public class AutomationElementIdentifiers { public static readonly AutomationProperty HeadingLevelProperty; public static readonly AutomationProperty IsDialogProperty; public static readonly AutomationEvent NotificationEvent; public static readonly AutomationEvent ActiveTextPositionChangedEvent; } public sealed class NotificationEventArgs : AutomationEventArgs { public NotificationEventArgs( AutomationNotificationKind notificationKind, AutomationNotificationProcessing notificationProcessing, string displayString, string activityId); public AutomationNotificationKind NotificationKind { get; } public AutomationNotificationProcessing NotificationProcessing { get; } public string DisplayString { get; } public string ActivityId { get; } } public sealed class ActiveTextPositionChangedEventArgs : AutomationEventArgs { public ActiveTextPositionChangedEventArgs( ITextRangeProvider textRange); public ITextRangeProvider TextRange { get; } } } namespace System.Windows.Automation.Peers { public enum AutomationEvents { (... previously defined values...), Notification = 19, ActiveTextPositionChanged = 20, } public class AutomationPeer { public AutomationHeadingLevel GetHeadingLevel(); protected virtual AutomationHeadingLevel GetHeadingLevelCore(); public bool IsDialog(); protected virtual bool IsDialogCore(); public void RaiseNotificationEvent( AutomationNotificationKind notificationKind, AutomationNotificationProcessing notificationProcessing, string displayString, string activityId); } public class ContentElementAutomationPeer { protected override AutomationHeadingLevel GetHeadingLevelCore(); protected override bool IsDialogCore(); } public class UIElementAutomationPeer { protected override AutomationHeadingLevel GetHeadingLevelCore(); protected override bool IsDialogCore(); } public class UIElement3DAutomationPeer { protected override AutomationHeadingLevel GetHeadingLevelCore(); protected override bool IsDialogCore(); } public class DataGridCellItemAutomationPeer { protected override AutomationHeadingLevel GetHeadingLevelCore(); protected override bool IsDialogCore(); } } ``` -------------------------------- ### Arcade Template Directory Structure Source: https://github.com/dotnet/wpf/blob/main/eng/common/template-guidance.md The file structure for templates and core-templates, categorized by their functional role in the pipeline. ```text eng\common\ [templates || templates-official]\ job\ job.yml (shim + artifact publishing logic) onelocbuild.yml (shim) publish-build-assets.yml (shim) source-build.yml (shim) source-index-stage1.yml (shim) jobs\ jobs.yml (shim) source-build.yml (shim) post-build\ post-build.yml (shim) common-variabls.yml (shim) setup-maestro-vars.yml (shim) steps\ publish-build-artifacts.yml (logic) publish-pipeline-artifacts.yml (logic) component-governance.yml (shim) publish-logs.yml (shim) retain-build.yml (shim) send-to-helix.yml (shim) source-build.yml (shim) variables\ pool-providers.yml (logic + redirect) # templates/variables/pool-providers.yml will redirect to templates-official/variables/pool-providers.yml if you are running in the internal project core-templates\ job\ job.yml (logic) onelocbuild.yml (logic) publish-build-assets.yml (logic) source-build.yml (logic) source-index-stage1.yml (logic) jobs\ jobs.yml (logic) source-build.yml (logic) post-build\ common-variabls.yml (logic) post-build.yml (logic) setup-maestro-vars.yml (logic) steps\ component-governance.yml (logic) publish-build-artifacts.yml (redirect) publish-logs.yml (logic) publish-pipeline-artifacts.yml (redirect) retain-build.yml (logic) send-to-helix.yml (logic) source-build.yml (logic) variables\ pool-providers.yml (redirect) ``` -------------------------------- ### Run GenAPI via MSBuild Source: https://github.com/dotnet/wpf/blob/main/Documentation/gen-api.md Set this MSBuild property during a build to trigger GenAPI, which reads the runtime assembly and generates a new {AssemblyName}.cs file in the ref directory. ```msbuild /p:GenerateReferenceAssemblySource=true ``` -------------------------------- ### NotificationEventArgs constructor Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Constructor for NotificationEventArgs. Parameters: notificationKind (AutomationNotificationKind), notificationProcessing (AutomationNotificationProcessing), displayString (string), activityId (string). ```csharp public NotificationEventArgs( AutomationNotificationKind notificationKind, AutomationNotificationProcessing notificationProcessing, string displayString, string activityId); ``` -------------------------------- ### Use DefaultCommandLineArgument to omit /files: prefix in wc.exe Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/readme.txt Adds the DefaultCommandLineArgument attribute to the files field, allowing the /files: prefix to be omitted. The Main method still uses ParseCommandLineArguments and prints usage on error. ```csharp class WCArguments { public bool lines; public bool words; public bool chars; [Utilities.Utility.DefaultCommandLineArgument] public string[] files; } class WC { static void Main(string[] args) { WCArguments parsedArgs = new WCArguments(); if (!Utilities.Utility.ParseCommandLineArguments(args, parsedArgs)) { // error encountered in arguments. Display usage message System.Console.Write(Utilities.Utility.CommandLineArgumentsUsage(typeof(WCArguments))); } else { // insert application code here } } } ``` -------------------------------- ### Suppress WPF0001 warning in project file Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Suppresses the WPF0001 experimental API warning in the project file, required to use ThemeMode in code-behind. ```xml $(NoWarn);WPF0001 ``` -------------------------------- ### AutomationPeer.IsDialogCore Method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Protected virtual method on AutomationPeer that is called by IsDialog. Override in derived classes to provide the actual implementation. ```csharp protected virtual bool IsDialogCore(); ``` -------------------------------- ### ActiveTextPositionChangedEventArgs Constructor Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Initializes a new instance of the ActiveTextPositionChangedEventArgs class with the specified text range where the change occurred. ```csharp public ActiveTextPositionChangedEventArgs(ITextRangeProvider textRange); ``` -------------------------------- ### Renaming of redistributable assemblies Source: https://github.com/dotnet/wpf/blob/main/Documentation/redistributables.md Shows the renaming scheme for the redistributable assemblies to avoid clashes with application-provided versions: vcruntime140.dll becomes vcruntime140_cor3.dll and d3dcompiler_47.dll becomes d3dcompiler_47_cor3.dll. ```text - vcruntime140.dll -> renamed to vcruntime140_cor3.dll - d3dcompiler_47.dll -> renamed to d3dcompiler_47_cor3.dll ``` -------------------------------- ### Fluent theme accent color brushes Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Defines accent color brushes in Fluent theme resource dictionaries (Light.xaml, Dark.xaml, HC.xaml). Use these brushes with DynamicResource when writing new styles or customizing existing control styles. In High Contrast mode, these brushes are updated to use system highlight colors. ```xml ``` -------------------------------- ### AutomationPeer.GetHeadingLevel Method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Public method that returns the heading level of the element associated with the automation peer. Throws InvalidOperationException if a public call to this method is currently in progress. ```csharp public AutomationHeadingLevel GetHeadingLevel(); ``` -------------------------------- ### SetHeadingLevel(DependencyObject, AutomationHeadingLevel) method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Use to assign a heading level to a DependencyObject. The value parameter specifies the AutomationHeadingLevel to set. ```csharp public static void SetHeadingLevel(System.Windows.DependencyObject element, System.Windows.Automation.AutomationHeadingLevel value); ``` -------------------------------- ### Json.NET MIT license notice Source: https://github.com/dotnet/wpf/blob/main/THIRD-PARTY-NOTICES.TXT MIT License notice for Json.NET, copyright (c) 2007 James Newton-King. It grants permission to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the software, provided the copyright notice and permission notice are included in all copies or substantial portions. ```text The MIT License (MIT) Copyright (c) 2007 James Newton-King Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### AutomationPeer.GetHeadingLevelCore Method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Protected virtual method that is called by GetHeadingLevel when overridden in a derived class. Returns the heading level. ```csharp protected virtual AutomationHeadingLevel GetHeadingLevelCore(); ``` -------------------------------- ### Azure Storage Explorer location for msvcurt-c1xx blobs Source: https://github.com/dotnet/wpf/blob/main/Documentation/c++-private-tools.md Hierarchical path in Azure Storage Explorer where the msvcurt-c1xx blobs can be found. Writing to this storage account requires special permissions and is only available to Microsoft employees. ```text - Dotnet Engineering Services - Storage Accounts - netcorenativeassets - Blob Containers - resource-packages - external - windows - msvcurt-c1xx - msvcurt-c1xx-0.0.0.3-win64-x64.zip - msvcurt-c1xx-0.0.0.3-win32-x86.zip ``` -------------------------------- ### DRT run summary output Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Expected output after running DRTs locally with the -test parameter. Shows the summary of test results, including counts for passed, failed (with and without BugIDs), and ignored tests. ```text A total of 1 test Infos were processed, with the following results. Passed: 1 Failed (need to analyze): 0 Failed (with BugIDs): 0 Ignore: 0 ``` -------------------------------- ### msvcurt-c1xx blob URLs Source: https://github.com/dotnet/wpf/blob/main/Documentation/c++-private-tools.md Locations of the private msvcurt-c1xx packages on Azure blob storage. The version 0.0.0.3 is arbitrary and may be updated in the future. ```text - https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/msvcurt-c1xx/msvcurt-c1xx-0.0.0.3-win32-x86.zip - https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/msvcurt-c1xx/msvcurt-c1xx-0.0.0.3-win64-x64.zip ``` -------------------------------- ### AutomationElement.HeadingLevelProperty field Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Identifies the HeadingLevel property for UI Automation client applications. Providers should use the equivalent field from AutomationElementIdentifiers. ```csharp public static readonly System.Windows.Automation.AutomationProperty HeadingLevelProperty; ``` -------------------------------- ### RaiseNotificationEvent method signature Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Use this method to raise a notification event from an AutomationPeer. The notificationKind and notificationProcessing parameters specify the type and processing order, while displayString provides a human-readable description and activityId can carry additional non-localized information to the event handler. ```csharp public void RaiseNotificationEvent(AutomationNotificationKind notificationKind, AutomationNotificationProcessing notificationProcessing, string displayString, string activityId); ``` -------------------------------- ### ContentElementAutomationPeer.IsDialogCore Method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Override of IsDialogCore in ContentElementAutomationPeer. Called by IsDialog to determine if the associated element is a dialog window. ```csharp protected override bool IsDialogCore(); ``` -------------------------------- ### AutomationPeer.IsDialog Method Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Public method on AutomationPeer that returns whether the associated element is a dialog window. Throws InvalidOperationException if a public call to this method is already in progress. ```csharp public bool IsDialog(); ``` -------------------------------- ### Correct multi-line T4 code block Source: https://github.com/dotnet/wpf/blob/main/Documentation/codegen.md Shows the recommended formatting for multi-line code inside T4 tags: the <# and #> tags on separate lines to clearly delimit the code block. ```text <# string helloWorld = " Hello World "; hellowWorld = helloWorld.Trim(); #> <#= hellowWorld #> ``` -------------------------------- ### Set Window ThemeMode to Dark in XAML Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Sets the Fluent theme on a Window by assigning the ThemeMode property to Dark in XAML. Window ThemeMode takes precedence over Application ThemeMode when set. ```xml ``` -------------------------------- ### Set Application ThemeMode to Dark in XAML Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Sets the Fluent theme on the Application level by assigning the ThemeMode property to Dark in XAML. This is an experimental API and requires suppressing the WPF0001 warning when used in code-behind. ```xml ``` -------------------------------- ### AutomationProperties.HeadingLevelProperty Field Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Identifies the HeadingLevel attached property. This field is a static readonly DependencyProperty. ```csharp public static readonly System.Windows.DependencyProperty HeadingLevelProperty; ```