### Install WPF Project Template Source: https://github.com/dotnet/wpf/blob/main/packaging/Microsoft.Dotnet.Wpf.ProjectTemplates/readme.MD Installs a local WPF project template using the `dotnet new install` command. Ensure you provide the correct path to the template content. ```bash > dotnet new install \wpf\packaging\Microsoft.Dotnet.Wpf.ProjectTemplates\content\WpfApplication-CSharp ``` -------------------------------- ### Verify Installed Templates Source: https://github.com/dotnet/wpf/blob/main/packaging/Microsoft.Dotnet.Wpf.ProjectTemplates/readme.MD Lists all installed .NET templates, including custom ones, to confirm successful installation. Use `dotnet new uninstall` to see the list. ```bash > dotnet new uninstall ``` -------------------------------- ### WpfHostUm_VersionActivateStart_V0 Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Event indicating the start of version activation in the WPF host. ```APIDOC ## WpfHostUm_VersionActivateStart_V0 ### Description Event indicating the start of version activation in the WPF host. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### WpfHostUm_WinMainStart_V0 Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Event indicating the start of the WPF main window. ```APIDOC ## WpfHostUm_WinMainStart_V0 ### Description Event indicating the start of the WPF main window. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Copy WPF binaries to a test host installation Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Deploy assemblies to a dedicated test host environment to avoid modifying the shared .NET installation. ```powershell eng\copy-wpf.ps1 -testhost -destination "c:\testhost\x86" ``` ```powershell eng\copy-wpf.ps1 -testhost -destination "c:\testhost\x86" -version "3.0.0-preview6-27728-04" ``` -------------------------------- ### Install specific WindowsDesktop runtime versions Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Automate the installation of 32-bit and 64-bit WindowsDesktop runtimes using the dotnet-install script. This is useful for reproducing issues or comparing behavior across versions. ```ps1 $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 ``` -------------------------------- ### Define WpfHost_DownloadApplicationStart Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_DownloadApplicationStart event structure. Use this for tracking the start of downloading the application. ```csharp [Dynamic, Description("WpfHost_DownloadApplicationStart") : amended, EventType(57), EventTypeName("WpfHost_DownloadApplicationStart") : amended ] class WpfHost_DownloadApplicationStart_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Define WpfHost_RootBrowserWindowSetupStart Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_RootBrowserWindowSetupStart event structure. Use this for tracking the start of setting up the root browser window. ```csharp [Dynamic, Description("WpfHost_RootBrowserWindowSetupStart") : amended, EventType(31), EventTypeName("WpfHost_RootBrowserWindowSetupStart") : amended ] class WpfHost_RootBrowserWindowSetupStart_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Example of Using 1ES Managed Templates Source: https://github.com/dotnet/wpf/blob/main/eng/common/template-guidance.md This example demonstrates how to configure a pipeline to use 1ES managed templates, specifically utilizing the `outputs` feature to consolidate artifacts and reduce security scans. Ensure publish artifacts are located in `$(Build.ArtifactStagingDirectory)`. ```yaml 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' ``` -------------------------------- ### Verify test host environment variables Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Example output confirming that the script has correctly configured the environment for the test host. ```text ** Setting env:DOTNET_ROOT(x86) to c:\testhost\x86 ** ** Setting env:DOTNET_MULTILEVEL_LOOKUP to 0 ** ``` -------------------------------- ### WpfHostUm_ParsingMarkupVersionStart_V0 Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Event indicating the start of parsing the markup version in the WPF host. ```APIDOC ## WpfHostUm_ParsingMarkupVersionStart_V0 ### Description Event indicating the start of parsing the markup version in the WPF host. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Define WpfHost_InitAppProxyStart Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_InitAppProxyStart event structure. Use this for tracking the start of initializing the application proxy. ```csharp [Dynamic, Description("WpfHost_InitAppProxyStart") : amended, EventType(19), EventTypeName("WpfHost_InitAppProxyStart") : amended ] class WpfHost_InitAppProxyStart_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Define WpfHost_DownloadDeplManifestStart Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_DownloadDeplManifestStart event structure. Use this for tracking the start of downloading the deployment manifest. ```csharp [Dynamic, Description("WpfHost_DownloadDeplManifestStart") : amended, EventType(53), EventTypeName("WpfHost_DownloadDeplManifestStart") : amended ] class WpfHost_DownloadDeplManifestStart_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Define Trace Configuration Sections Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/PresentationCore/AvTraceMessages.txt Example format for defining trace sources, areas, and associated wrapper classes in the configuration file. ```text [System.Windows,Area,TraceClass] TraceBasic=,,{"basic msg", "data1", "data2"} TraceFormat=,FORMAT,{" {0} is doing something to {1}.", "data1", "data2"} [end] ``` -------------------------------- ### Define WpfHost_DocObjHostRunApplicationStart Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_DocObjHostRunApplicationStart event structure. Use this for tracking the start of running a document object host application. ```csharp [Dynamic, Description("WpfHost_DocObjHostRunApplicationStart") : amended, EventType(15), EventTypeName("WpfHost_DocObjHostRunApplicationStart") : amended ] class WpfHost_DocObjHostRunApplicationStart_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Define WpfHost_AssertAppRequirementsStart Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_AssertAppRequirementsStart event structure. Use this for tracking the start of asserting application requirements. ```csharp [Dynamic, Description("WpfHost_AssertAppRequirementsStart") : amended, EventType(55), EventTypeName("WpfHost_AssertAppRequirementsStart") : amended ] class WpfHost_AssertAppRequirementsStart_V0:TWpfHost__V0 { }; ``` -------------------------------- ### WpfHostUm_StartingCLRStart_V0 Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Event indicating the start of the Common Language Runtime (CLR) initialization in the WPF host. ```APIDOC ## WpfHostUm_StartingCLRStart_V0 ### Description Event indicating the start of the Common Language Runtime (CLR) initialization in the WPF host. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Uninstall WPF Project Template Source: https://github.com/dotnet/wpf/blob/main/packaging/Microsoft.Dotnet.Wpf.ProjectTemplates/readme.MD Uninstalls a previously installed local WPF project template. Use the path provided during installation or from the `dotnet new uninstall` output. ```bash > dotnet new uninstall \wpf\packaging\Microsoft.Dotnet.Wpf.ProjectTemplates\content\WpfApplication-CSharp ``` -------------------------------- ### Define WpfHost_AppProxyRunStart Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_AppProxyRunStart event structure. Use this for tracking the start of running the application proxy. ```csharp [Dynamic, Description("WpfHost_AppProxyRunStart") : amended, EventType(33), EventTypeName("WpfHost_AppProxyRunStart") : amended ] class WpfHost_AppProxyRunStart_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Define WpfHost_DetermineApplicationTrustStart Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_DetermineApplicationTrustStart event structure. Use this for tracking the start of determining application trust. ```csharp [Dynamic, Description("WpfHost_DetermineApplicationTrustStart") : amended, EventType(43), EventTypeName("WpfHost_DetermineApplicationTrustStart") : amended ] class WpfHost_DetermineApplicationTrustStart_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Opting an Assembly into a Package Source: https://github.com/dotnet/wpf/blob/main/Documentation/packaging.md Example of setting the PackageName property within Packaging.props to include an assembly in a specific package. ```xml $(DncEngTransportPackageName) ``` -------------------------------- ### WPF Host ClickOnce Activation Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the event for ClickOnce activation start in the WPF Host. ```APIDOC ## Template_51_V0 (WpfHost_ClickOnceActivationStart) ### Description Represents the start of a ClickOnce activation. ### Event Type 17 ### Event Type Name WpfHost_ClickOnceActivationStart ### Parameters #### Request Body - **Direct** (sint8) - Required - Indicates if the activation is direct. ``` -------------------------------- ### WpfHostUm_IPersistMonikerLoadStart_V0 Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Event indicating the start of loading a moniker using IPersistMoniker in the WPF host. ```APIDOC ## WpfHostUm_IPersistMonikerLoadStart_V0 ### Description Event indicating the start of loading a moniker using IPersistMoniker in the WPF host. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### WClientLayoutFireAutomationEvents Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the start and end events for firing automation events related to WClientLayout. ```APIDOC ## WClientLayoutFireAutomationEventsBegin_V2 ### Description Represents the beginning of firing automation events for WClientLayout. ### Method N/A ### Endpoint N/A ## WClientLayoutFireAutomationEventsEnd_V2 ### Description Represents the end of firing automation events for WClientLayout. ### Method N/A ### Endpoint N/A ``` -------------------------------- ### Create and run a new WPF application Source: https://github.com/dotnet/wpf/blob/main/Documentation/getting-started.md Use the dotnet CLI to scaffold a new WPF project and execute it immediately. ```cmd dotnet new wpf -o MyWPFApp cd MyWPFApp dotnet run ``` -------------------------------- ### Get Text Range from ActiveTextPositionChangedEventArgs Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the text range where the change occurred. Returns null if the entire content of the text provider is affected. ```csharp public ITextRangeProvider TextRange { get; } ``` -------------------------------- ### Get IsDialog Attached Property in C# Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the IsDialog attached property for the specified DependencyObject. This method retrieves a boolean value indicating if the element is a dialog window. ```csharp public static bool GetIsDialog(System.Windows.DependencyObject element); ``` -------------------------------- ### Get Heading Level of Element in C# Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the heading level of the element associated with this automation peer. This method can throw an InvalidOperationException if a public call is already in progress. ```csharp public AutomationHeadingLevel GetHeadingLevel(); ``` -------------------------------- ### Define WpfHost_XappLauncherAppStartup Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_XappLauncherAppStartup event structure. Use this for tracking the startup of the Xapp Launcher application. ```csharp [Dynamic, Description("WpfHost_XappLauncherAppStartup") : amended, EventType(13), EventTypeName("WpfHost_XappLauncherAppStartup") : amended ] class WpfHost_XappLauncherAppStartup_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Get IsDialog Status in C# Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets a value that indicates whether the element associated with this automation peer is a dialog window. This method can throw an InvalidOperationException if called during an ongoing operation. ```csharp public bool IsDialog(); ``` -------------------------------- ### MyExample Class API Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/0spec_template.md Overview of the MyExample class members including PropertyOne, PropertyTwo, and MethodOne. ```APIDOC ## MyExample Class ### Description Represents the MyExample class structure. ### Properties - **PropertyOne** (int) - Read/Write - Brief description about the MyExample.PropertyOne property. - **PropertyTwo** (string) - Read-only - Brief description of the PropertyTwo property (defaults to ...). ### Methods - **MethodOne()** - Brief description of the MethodOne method. ### API Signature ```c# runtimeclass MyExample { int PropertyOne { get; set; } string PropertyTwo { get; private set; } void MethodOne(); } ``` ``` -------------------------------- ### AutomationProperties.GetIsDialog(DependencyObject) Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the IsDialog attached property for the specified DependencyObject. ```APIDOC ## AutomationProperties.GetIsDialog(DependencyObject) Method Gets the [IsDialog]() attached property for the specified [DependencyObject](). ```csharp public static bool GetIsDialog(System.Windows.DependencyObject element); ``` ### Parameters **element** [DependencyObject]() - The specified [DependencyObject](). ### Returns [Boolean]() - The value of the [AutomationProperties.IsDialog]() property. ``` -------------------------------- ### AutomationPeer.GetHeadingLevel Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the heading level of the element that is associated with this automation peer. ```APIDOC ## AutomationPeer.GetHeadingLevel Method Gets the heading level of the element that is associated with this automation peer. ```csharp public AutomationHeadingLevel GetHeadingLevel(); ``` ### Returns [AutomationHeadingLevel]() The heading level. ### Exceptions [InvalidOperationException]() A public call to this method is currently in progress. ``` -------------------------------- ### UIElement3DAutomationPeer.GetHeadingLevelCore Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the heading level of the UIElement3D that is associated with this UIElement3DAutomationPeer. Called by GetHeadingLevel(). ```APIDOC ## UIElement3DAutomationPeer.GetHeadingLevelCore Method Gets the heading level of the [UIElement3D]() that is associated with this [UIElement3DAutomationPeer](). Called by [GetHeadingLevel()](). ```csharp protected override AutomationHeadingLevel GetHeadingLevelCore(); ``` ### Returns [AutomationHeadingLevel]() The heading level. ``` -------------------------------- ### WPF Packaging File Structure Source: https://github.com/dotnet/wpf/blob/main/Documentation/packaging.md Displays the directory layout for packaging props, targets, and project 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 ``` -------------------------------- ### UIElementAutomationPeer.GetHeadingLevelCore Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the heading level of the UIElement that is associated with this UIElementAutomationPeer. Called by GetHeadingLevel(). ```APIDOC ## UIElementAutomationPeer.GetHeadingLevelCore Method Gets the heading level of the [UIElement]() that is associated with this [UIElementAutomationPeer](). Called by [GetHeadingLevel()](). ```csharp protected override AutomationHeadingLevel GetHeadingLevelCore(); ``` ### Returns [AutomationHeadingLevel]() The heading level. ``` -------------------------------- ### ContentElementAutomationPeer.GetHeadingLevelCore Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the heading level of the ContentElement that is associated with this ContentElementAutomationPeer. Called by GetHeadingLevel(). ```APIDOC ## ContentElementAutomationPeer.GetHeadingLevelCore Method Gets the heading level of the [ContentElement]() that is associated with this [ContentElementAutomationPeer](). Called by [GetHeadingLevel()](). ```csharp protected override AutomationHeadingLevel GetHeadingLevelCore(); ``` ### Returns [AutomationHeadingLevel]() The heading level. ``` -------------------------------- ### MyExample Class Definition Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/0spec_template.md Defines the MyExample runtime class with its properties and methods. PropertyTwo is settable only internally. ```csharp runtimeclass MyExample { int PropertyOne { get; set; } string PropertyTwo { get; private set; } void MethodOne(); } ``` -------------------------------- ### Build WPF Locally with Specific Configuration Source: https://github.com/dotnet/wpf/wiki/Building-WPF-Locally Use the build.cmd script to compile WPF projects locally. Specify the desired platform (e.g., x64) and configuration (e.g., release) using command-line arguments. ```bash ./build.cmd -c release -plat x64 ``` -------------------------------- ### ItemAutomationPeer.GetHeadingLevelCore Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the heading level of the element that is associated with this automation peer. Called by GetHeadingLevel(). ```APIDOC ## ItemAutomationPeer.GetHeadingLevelCore Method Gets the heading level of the element that is associated with this automation peer. Called by [GetHeadingLevel()](). ```csharp protected override AutomationHeadingLevel GetHeadingLevelCore(); ``` ### Returns [AutomationHeadingLevel]() The heading level. ``` -------------------------------- ### DateTimeAutomationPeer.GetHeadingLevelCore Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the heading level of the element that is associated with this automation peer. Called by GetHeadingLevel(). ```APIDOC ## DateTimeAutomationPeer.GetHeadingLevelCore Method Gets the heading level of the element that is associated with this automation peer. Called by [GetHeadingLevel()](). ```csharp protected override AutomationHeadingLevel GetHeadingLevelCore(); ``` ### Returns [AutomationHeadingLevel]() The heading level. ``` -------------------------------- ### Define WpfHost_RootBrowserWindowSetupEnd Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_RootBrowserWindowSetupEnd event structure. Use this for tracking the end of setting up the root browser window. ```csharp [Dynamic, Description("WpfHost_RootBrowserWindowSetupEnd") : amended, EventType(32), EventTypeName("WpfHost_RootBrowserWindowSetupEnd") : amended ] class WpfHost_RootBrowserWindowSetupEnd_V0:TWpfHost__V0 { }; ``` -------------------------------- ### DataGridCellItemAutomationPeer.GetHeadingLevelCore Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets the heading level of the element that is associated with this automation peer. Called by GetHeadingLevel(). ```APIDOC ## DataGridCellItemAutomationPeer.GetHeadingLevelCore Method Gets the heading level of the element that is associated with this automation peer. Called by [GetHeadingLevel()](). ```csharp protected override AutomationHeadingLevel GetHeadingLevelCore(); ``` ### Returns [AutomationHeadingLevel]() The heading level. ``` -------------------------------- ### Access HeadingLevel Methods Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Methods to get or set the HeadingLevel attached property on a DependencyObject. ```c# public static System.Windows.Automation.AutomationHeadingLevel GetHeadingLevel(System.Windows.DependencyObject element); ``` ```c# public static void SetHeadingLevel(System.Windows.DependencyObject element, System.Windows.Automation.AutomationHeadingLevel value); ``` -------------------------------- ### WPF Host Download Page Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the event for GetDownloadPageStart in the WPF Host. ```APIDOC ## Template_54_V0 (WpfHost_GetDownloadPageStart) ### Description Represents the start of getting a download page. ### Event Type 51 ### Event Type Name WpfHost_GetDownloadPageStart ### Parameters #### Request Body - **Page** (string) - Required - The name of the page to download. ``` -------------------------------- ### Define WpfHost_FirstTimeActivation Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_FirstTimeActivation event structure. Use this for tracking first-time application activations. ```csharp [Dynamic, Description("WpfHost_FirstTimeActivation") : amended, EventType(50), EventTypeName("WpfHost_FirstTimeActivation") : amended ] class WpfHost_FirstTimeActivation_V0:TWpfHost__V0 { }; ``` -------------------------------- ### AutomationProperties.IsDialog Attached Property Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets or sets a value that indicates whether an element is a dialog window. ```APIDOC ## AutomationProperties.IsDialog Attached Property Gets or sets a value that indicates whether an element is a dialog window. ```csharp see GetIsDialog, and SetIsDialog ``` ### Remarks In many cases, assistive technology (AT) treats a dialog window differently from other types of windows. A screen reader, for example, typically speaks the title of the dialog, the focused control in the dialog, and then the content of the dialog up to the focused control (for example, "Do you want to save your changes before closing"). For standard windows, a screen reader typically speaks the window title followed by the focused control. When AutomationProperties.IsDialog is true, a client application should treat the element as a dialog window. ``` -------------------------------- ### WPF Host XappLauncher Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the event for XappLauncherAppExit in the WPF Host. ```APIDOC ## Template_53_V0 (WpfHost_XappLauncherAppExit) ### Description Represents the exit of an application launched by XappLauncher. ### Event Type 14 ### Event Type Name WpfHost_XappLauncherAppExit ### Parameters #### Request Body - **AttemptDownload** (sint8) - Required - Indicates if a download was attempted. ``` -------------------------------- ### AutomationProperties API Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Provides static methods to get and set automation properties like HeadingLevel and IsDialog on DependencyObjects. ```APIDOC ## AutomationProperties ### Description Provides attached property accessors for UI automation elements. ### Methods - **GetHeadingLevel(DependencyObject element)**: Returns the AutomationHeadingLevel for the specified element. - **SetHeadingLevel(DependencyObject element, AutomationHeadingLevel value)**: Sets the AutomationHeadingLevel for the specified element. - **GetIsDialog(DependencyObject element)**: Returns a boolean indicating if the element is a dialog. - **SetIsDialog(DependencyObject element, bool value)**: Sets the IsDialog property for the specified element. ``` -------------------------------- ### Define WpfHost_DownloadApplicationEnd Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_DownloadApplicationEnd event structure. Use this for tracking the end of downloading the application. ```csharp [Dynamic, Description("WpfHost_DownloadApplicationEnd") : amended, EventType(58), EventTypeName("WpfHost_DownloadApplicationEnd") : amended ] class WpfHost_DownloadApplicationEnd_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Create WPF Application from Template Source: https://github.com/dotnet/wpf/blob/main/packaging/Microsoft.Dotnet.Wpf.ProjectTemplates/readme.MD Creates a new WPF application named 'testapp1' using the 'wpf' template. This command assumes the 'wpf' template is available in your environment. ```bash > dotnet new wpf -n testapp1 ``` -------------------------------- ### Template_46_V0 Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Indicates the ready state of a WPF host component. ```APIDOC ## Template_46_V0 ### Description Indicates the ready state of a WPF host component. ### Method N/A ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **State** (uint32) - The ready state value. #### Response Example ```json { "State": 1 } ``` ``` -------------------------------- ### Run Csp Unit Tests Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/WpfGfx/tools/csp/README.md Execute the Csp unit tests by running this command from the root of the WPF repository. This command specifies the project file to be used for running the tests. ```batch build.cmd -projects "src\Microsoft.DotNet.Wpf\src\WpfGfx\tools\csp\RunUnitTests.proj" ``` -------------------------------- ### Enable Fluent Theme via ResourceDictionary Source: https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md Apply the Fluent theme globally or to specific windows by referencing the Fluent.xaml resource dictionary. ```xml ``` ```xml ``` -------------------------------- ### Get All Annotations API Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Retrieves a list of all available annotations. This API includes methods to initiate the request and process the response. ```APIDOC ## GET /api/annotations ### Description Retrieves a list of all annotations. ### Method GET ### Endpoint /api/annotations ### Response #### Success Response (200) - **annotations** (array) - A list of all annotation objects. ### Response Example { "annotations": [ { "id": "annotation-1", "content": "Content 1" }, { "id": "annotation-2", "content": "Content 2" } ] } ``` -------------------------------- ### Define WpfHost_InitAppProxyEnd Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_InitAppProxyEnd event structure. Use this for tracking the end of initializing the application proxy. ```csharp [Dynamic, Description("WpfHost_InitAppProxyEnd") : amended, EventType(20), EventTypeName("WpfHost_InitAppProxyEnd") : amended ] class WpfHost_InitAppProxyEnd_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Define WpfHost_DownloadDeplManifestEnd Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_DownloadDeplManifestEnd event structure. Use this for tracking the end of downloading the deployment manifest. ```csharp [Dynamic, Description("WpfHost_DownloadDeplManifestEnd") : amended, EventType(54), EventTypeName("WpfHost_DownloadDeplManifestEnd") : amended ] class WpfHost_DownloadDeplManifestEnd_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Get Annotation by Location API Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Retrieves annotations based on their location. This API supports initiating the request and handling the response. ```APIDOC ## GET /api/annotations/location ### Description Retrieves annotations based on their location. ### Method GET ### Endpoint /api/annotations/location ### Query Parameters - **x** (number) - Required - The x-coordinate of the location. - **y** (number) - Required - The y-coordinate of the location. ### Response #### Success Response (200) - **annotations** (array) - A list of annotation objects found at the specified location. ### Response Example { "annotations": [ { "id": "annotation-1", "content": "Content 1" }, { "id": "annotation-2", "content": "Content 2" } ] } ``` -------------------------------- ### Get Heading Level Core in C# Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md When overridden in a derived class, this method is called by GetHeadingLevel() to retrieve the heading level. ```csharp protected virtual AutomationHeadingLevel GetHeadingLevelCore(); ``` -------------------------------- ### WClientCreateVisual Events Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Documentation for WClientCreateVisual events. ```APIDOC ## TWClientCreateVisual_V0 ### Description Base class for WClientCreateVisual events with EventVersion 2. ### Method N/A ### Endpoint N/A ## Template_18_V0 (WClientCreateVisual) ### Description Represents a WClientCreateVisual event. ### Method N/A ### Endpoint N/A ### Parameters #### Query Parameters - **Id** (sint32) - read - The ID of the visual. - **HWND** (sint64) - read - The HWND associated with the visual. ``` -------------------------------- ### Define WpfHost_DocObjHostCreated Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_DocObjHostCreated event structure. Use this for tracking the creation of document object hosts. ```csharp [Dynamic, Description("WpfHost_DocObjHostCreated") : amended, EventType(10), EventTypeName("WpfHost_DocObjHostCreated") : amended ] class WpfHost_DocObjHostCreated_V0:TWpfHost__V0 { }; ``` -------------------------------- ### Configure Design-Time T4 Templates in SDK-style Projects Source: https://github.com/dotnet/wpf/blob/main/Documentation/codegen.md Use this pattern to import necessary targets when using SDK-style project formats to ensure proper build order. ```xml ``` -------------------------------- ### DatePicker Watermark Text Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/PresentationFramework/Resources/ExceptionStringTable.txt Specifies the watermark text displayed in the DatePicker when no date is selected, guiding the user on how to enter a date. ```text DatePicker_WatermarkText=Select a date ``` -------------------------------- ### Configure Runtime Version via runtimeconfig.json Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Update this file next to your executable to specify the runtime version if you cannot build from source. ```json { "runtimeOptions": { "tfm": "netcoreapp3.0", "framework": { "name": "Microsoft.WindowsDesktop.App", "version": "3.0.0-preview5-27619-18" } } } ``` -------------------------------- ### Override GetHeadingLevelCore for ContentElementAutomationPeer in C# Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Overrides the base method to get the heading level of the ContentElement associated with this ContentElementAutomationPeer. Called by GetHeadingLevel(). ```csharp protected override AutomationHeadingLevel GetHeadingLevelCore(); ``` -------------------------------- ### WMI Class: KeyStringTemplate_V0 Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines a template for key-based string resources. ```APIDOC ## WMI Class KeyStringTemplate_V0 ### Description Defines a template for key-based string resources with a null-terminated string property. ### Parameters #### Request Body - **Key** (string) - Required - The key identifier for the resource. ``` -------------------------------- ### Reference local WPF binaries in project file Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Use this configuration in your project file to override standard assembly references with locally built binaries. Ensure the WpfRepoRoot and WpfConfig variables are updated to match your local environment. ```xml d:\dev\src\dotnet\wpf Debug Microsoft.DotNet.Wpf.GitHub.Debug true win-x86 ``` -------------------------------- ### Override IsDialogCore for ContentElementAutomationPeer in C# Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/specs/AutomationUpdate.md Gets a value that indicates whether the element associated with this automation peer is a dialog window. Called by IsDialog(). ```csharp protected override bool IsDialogCore(); ``` -------------------------------- ### WMI Event: CreateHighlight Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines events for creating highlights. ```APIDOC ## WMI Event CreateHighlight ### Description Tracks the lifecycle of creating a highlight in WPF. ### Event Types - **CreateHighlightBegin** (EventType: 1) - **CreateHighlightEnd** (EventType: 2) ``` -------------------------------- ### WPF Host Download Progress Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the event for DownloadProgressUpdate in the WPF Host. ```APIDOC ## Template_55_V0 (WpfHost_DownloadProgressUpdate) ### Description Represents an update in the download progress. ### Event Type 59 ### Event Type Name WpfHost_DownloadProgressUpdate ### Parameters #### Request Body - **Bytes** (uint32) - Required - The number of bytes processed. ``` -------------------------------- ### Get Annotation by ID API Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Retrieves a specific annotation using its unique identifier. This API includes methods to initiate the request and process the response. ```APIDOC ## GET /api/annotations/{id} ### Description Retrieves an annotation by its unique identifier. ### Method GET ### Endpoint /api/annotations/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the annotation. ### Response #### Success Response (200) - **annotation** (object) - The annotation object containing its details. ### Response Example { "annotation": { "id": "some-annotation-id", "content": "Annotation text" } } ``` -------------------------------- ### Define WpfHost_ApplicationActivatorCreateInstanceEnd Event Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Defines the WpfHost_ApplicationActivatorCreateInstanceEnd event structure. Use this for tracking the end of creating an instance via the ApplicationActivator. ```csharp [Dynamic, Description("WpfHost_ApplicationActivatorCreateInstanceEnd") : amended, EventType(42), EventTypeName("WpfHost_ApplicationActivatorCreateInstanceEnd") : amended ] class WpfHost_ApplicationActivatorCreateInstanceEnd_V0:TWpfHost__V0 { }; ``` -------------------------------- ### TWClientInputMessage_V0 Definition Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Base class for WClientInputMessage events, version 2. Includes attributes for dynamic properties, description, GUID, event version, and display name. ```csharp [Dynamic, Description("WClientInputMessage") : amended, guid("{4ac79bac-7dfb-4402-a910-fdafe16f29b2}"), EventVersion(2), DisplayName("WClientInputMessage") : amended ] class TWClientInputMessage_V0:Microsoft_Windows_WPF { }; ``` -------------------------------- ### Parse command line arguments with basic class mapping Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/readme.txt Define a class with fields representing command line arguments and use Utilities.Utility.ParseCommandLineArguments to populate it. ```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 } } } ``` -------------------------------- ### TWClientCreateVisual_V0 Definition Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Base class for WClientCreateVisual events, version 2. Includes attributes for dynamic properties, description, GUID, event version, and display name. ```csharp [Dynamic, Description("WClientCreateVisual") : amended, guid("{2dbecf62-51ea-493a-8dd0-4bee1ccbe8aa}"), EventVersion(2), DisplayName("WClientCreateVisual") : amended ] class TWClientCreateVisual_V0:Microsoft_Windows_WPF { }; ``` -------------------------------- ### Configure PlatformTarget in Project File Source: https://github.com/dotnet/wpf/blob/main/Documentation/developer-guide.md Add the PlatformTarget tag to your .csproj file to resolve the NETSDK1083 error when the RuntimeIdentifier is not recognized. ```xml WinExe net6.0-windows true x86 C:\wpf ``` -------------------------------- ### TWClientArrange_V1 Definition Source: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Shared/Tracing/native/wpf-etw.mof.txt Base class for WClientArrange events, version 1. Includes attributes for dynamic properties, description, GUID, event version, and display name. ```csharp [Dynamic, Description("WClientArrange") : amended, guid("{4b0ef3d1-0cbb-4847-b98f-16408e7e83f3}"), EventVersion(0), DisplayName("WClientArrange") : amended ] class TWClientArrange_V1:Microsoft_Windows_WPF { }; ```