[Peek] Update FilePreviewer to prevent tooltips from obscuring title bar controls #34718
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Update to prevent ImagePreview and VideoPreview controls' tooltips from obscuring the Main Window's title bar.
PR Checklist
Detailed Description of the Pull Request / Additional comments
When the user hovers over the top-right portion of an
ImagePreview
orVideoPreview
, the associated tooltip is opened, with the text bound toInfoToolTip
. This worked, but unfortunately the tooltip could obscure the Windows controls such as the close icon, which was an accessibility problem. This PR dynamically sets thePlacement
of the tooltip so it opens below the mouse pointer in the top portion of the previewers. ThePointerMoved
handler is generic, so will work with any future previewer which needs a tooltip.The tooltips are proper child elements of the previewer controls now, as they need to be instantiated.
I updated the StringBuilder which appends the tooltip contents to have an initial capacity of 256 characters. This prevents the builder from resizing itself multiple times. This is a tiny perf/allocation improvement.
Validation Steps Performed
Manual tests only: