diff --git a/Documentation/api-compat.md b/Documentation/api-compat.md index d1ebedee989..8cccac74a36 100644 --- a/Documentation/api-compat.md +++ b/Documentation/api-compat.md @@ -3,7 +3,7 @@ API compatibility is a build-time check that ensures that an `implementation` as For `WPF on .NET Core`, this means the following: * All `WPF on .NET Core` reference assemblies contain **at least** the API surface area contained by `WPF on .NET Framework 4.8` reference assemblies. -* All hand-crafted reference assemblies for `WPF on .NET Core` contain **exactly** the needed API surface area defined by their corresponding runtime assemblies. +* All hand-crafted reference assemblies for `WPF on .NET Core` contain **exactly** the needed API surface area defined by their corresponding runtime assemblies. (If you're adding new API surface area, you will need to update the hand-crafted reference assemblies, following [these instructions](https://github.com/dotnet/wpf/blob/main/Documentation/gen-api.md).) This is accomplished by the use of the [Arcade API Compatibility tool](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.ApiCompat) with some modifications to fit our specific needs. diff --git a/Documentation/gen-api.md b/Documentation/gen-api.md index 6aef273a45d..366ca5d68fb 100644 --- a/Documentation/gen-api.md +++ b/Documentation/gen-api.md @@ -35,12 +35,14 @@ GenAPI can be run by setting the following MSBuild property while building. When a build is run with that property enabled, GenAPI will read the runtime assembly and generate a new `{AssemblyName}.cs` file under the ref directory in the assembly's source tree. This new file will contain the newly created surface area and will need to be checked in along with the runtime assembly change. The next build without `GenerateReferenceAssemblySource` enabled will no longer display an ApiCompat error as the surface area will now match the baseline. -### Issues with GenAPI -Often, GenAPI will generate code output that will contain code that is either private, internal, or creates build errors. For this reason a developer usually cannot just use the output of GenAPI directly. Instead, the developer should do the following: + +### Workflow for GenAPI +GenAPI generates a lot of code that is either private, internal, or causes build errors. For this reason a developer usually cannot just use the output of GenAPI directly. Instead, the developer should do the following: * Build with GenAPI enabled * Diff the output file against the previous version -* Extract just the new surface area (and related code) from the generated code -* Revert the generated file +* Extract just the new surface area and related code from the generated code (this is typically a very small fraction of the diff) +* Restore the generated file * Add back the new surface area to the reference assembly code * Ensure that nothing in the new surface area is private or internal unless requried by XAML compilation or other reference assemblies +* Restore all other files GenAPI may have generated * Rebuild without GenAPI enabled and verify there are no ApiCompat errors diff --git a/eng/WpfArcadeSdk/tools/ApiCompat.targets b/eng/WpfArcadeSdk/tools/ApiCompat.targets index af60363d07f..f1fcdfb847a 100644 --- a/eng/WpfArcadeSdk/tools/ApiCompat.targets +++ b/eng/WpfArcadeSdk/tools/ApiCompat.targets @@ -10,8 +10,9 @@ and !($(MSBuildProjectName.Contains('_wpftmp')))">true - - + + false + +Title +== + +# Background + + + +# Conceptual pages (How To) + +_(This is conceptual documentation that will go to docs.microsoft.com "how to" page)_ + + + +# API Pages + +_(Each of the following L2 sections correspond to a page that will be on docs.microsoft.com)_ + + + +## MyExample class + +Brief description of this class. + +Introduction to one or more example usages of a MyExample class: + +```c# +... + +``` + +Remarks about the MyExample class + + +## MyExample.PropertyOne property + +Brief description about the MyExample.PropertyOne property. + +_Spec note: internal comment about this property that won't go into the public docs._ + +Introduction to one or more usages of the MyExample.PropertyOne property. + + +## Other MyExample members + + +| Name | Description +|-|-| +| PropertyTwo | Brief description of the PropertyTwo property (defaults to ...) | +| MethodOne | Brief description of the MethodOne method | + +# Spec notes + +This section describes details that are not part of the public documentation, but are nevertheless important. + +# Discussion + + +# Summary of behavior changes + +For convenience, here are the behavior changes described in detail above. + +# API Details + +For convenience, here is a summary of the new public API surface. + +```c# +runtimeclass MyExample +{ + int PropertyOne { get; set; } + string PropertyTwo { get; private set; } + void MethodOne(); +} +``` diff --git a/src/Microsoft.DotNet.Wpf/specs/tooltip.md b/src/Microsoft.DotNet.Wpf/specs/tooltip.md index 9ec597270ea..16844263a12 100644 --- a/src/Microsoft.DotNet.Wpf/specs/tooltip.md +++ b/src/Microsoft.DotNet.Wpf/specs/tooltip.md @@ -141,7 +141,7 @@ Gets or sets whether the ToolTip is shown when its parent element acquires keybo Setting this property on a ToolTip element helps control whether to open the tooltip when its parent element acquires focus by keyboard navigation. See `ToolTipService.ShowsToolTipOnKeyboardFocus` (the previous section) for details. -# Implementation +# Spec Notes This section describes details that are not part of the public documentation, but are nevertheless important. **ShowDuration property**. @@ -258,6 +258,8 @@ Unfortunately this only helps in .NET 6.0, as servicing updates to older version [ET] discussed what that really means - whether to act on KeyDown or KeyUp, whether combinations should cause both the combination action and dismiss the tooltip (e.g. should Ctrl+C both copy text and dismiss the tooltip), etc. The interpretation given here is the consensus. +[FD] doesn't say whether Ctrl closes any tooltip, or just the one whose parent has focus. The consensus in [ET] was that Ctrl closes the tooltip whose parent has focus, provided it was opened from the keyboard. + [FD] and [MAS] allude to the delay before opening a tooltip, but don't specify how long that should be, or whether it should be different for keyboard vs. mouse. The consensus in [ET] was * the keyboard delay should be no less than the mouse delay @@ -278,15 +280,15 @@ For convenience, here are the behavior changes described in detail above. 1. Change default value for `ToolTipService.ShowDuration` property from 5000 to `Int32.MaxValue`. 2. Moving the mouse within the safe area does not close the tooltip. -3. (6.0 only) Properties `ToolTip.ShowsToolTipOnKeyboardFocus` and `TooltipService.ShowsToolTipOnKeyboardFocus` control whether acquiring keyboard focus shows the tooltip. +3. (6.0 only) Properties `ToolTip.ShowsToolTipOnKeyboardFocus` and `TooltipService.ShowsToolTipOnKeyboardFocus` control whether keyboard navigation shows the tooltip. 4. Ctrl closes the tooltip. 5. Ctrl+Shift+F10 opens the tooltip immediately, rather than after `InitialShowDelay`. -6. RibbonToolTips default to showing on focus acquisition. +6. RibbonToolTips default to showing on keyboard navigation. 7. Change default value for `ToolTipService.InitialShowDelay` property from `SystemParameters.MouseHoverTimeMilliseconds` to 1000. Also, some changes were previously made in .NET 4.8 (and appear in .NET Core 3.0, 3.1, and .NET 5.0), without documentation: -1. Keyboard focus opens the tooltip. (Except for RibbonToolTip.) +1. Keyboard navigation opens the tooltip. (Except for RibbonToolTip.) 2. Ctrl-Shift-F10 opens or closes the tooltip. # API Details @@ -297,7 +299,7 @@ For convenience, here is a summary of the new public API surface. ```c# class ToolTipService { - public static DependencyProperty ShowsToolTipOnKeyboardFocus; + public static DependencyProperty ShowsToolTipOnKeyboardFocusProperty; public static bool? GetShowsToolTipOnKeyboardFocus(DependencyObject d); public static void SetShowsToolTipOnKeyboardFocus(DependencyObject d, bool? value); }