[Peek] Update FilePreviewer to prevent tooltips from obscuring title bar controls
Summary of the Pull Request
Update to prevent ImagePreview and VideoPreview controls' tooltips from obscuring the Main Window's title bar.
PR Checklist
- [x] Closes: #34496
- [ ] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [ ] Tests: Added/updated and all pass
- [ ] Localization: All end user facing strings can be localized
- [ ] Dev docs: Added/updated
- [ ] New binaries: Added on the required places
- [ ] JSON for signing for new binaries
- [ ] WXS for installer for new binaries and localization folder
- [ ] YML for CI pipeline for new test projects
- [ ] YML for signed pipeline
- [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx
Detailed Description of the Pull Request / Additional comments
When the user hovers over the top-right portion of an ImagePreview or VideoPreview, the associated tooltip is opened, with the text bound to InfoToolTip. 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 the Placement of the tooltip so it opens below the mouse pointer in the top portion of the previewers. The PointerMoved 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:
- Tested with a mix of image and movie files.
- Tested starting with a different previewer which doesn't use tooltips then navigating to an image or movie file which does need a tooltip.
- Tested starting with an image or movie file then navigating to a different file type then opening another image or movie file.