microsoft / microsoft/microsoft-ui-xaml
Proposal: Add ability to receive the rasterization scale in custom controls (or composition level)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Title
The proposal is to provide a mechanism for custom controls to be notified when the rasterization scale changes, allowing them to re-render their custom drawings as needed.
In WinUI 3, custom drawing is typically done through the Composition API. Therefore, the **Visual** element could expose an event that triggers when the rasterization scale changes for that specific visual. This would ensure that, when a custom control is placed inside a ScrollViewer and the user performs a zoom action, the control is notified and can redraw itself accordingly.
I originally posted this as a discussion here: [microsoft-ui-xaml/discussions/10783](https://github.com/microsoft/microsoft-ui-xaml/discussions/10783)
. The feedback received indicated that there is currently no proper way to handle this scenario, due to a limitation in the platform that leads to blurry drawings inside a ScrollViewer.
### Summary
Add RasterizationScaleChanged event in Visual to get notified of zoom operations in ScrollViewer
### Rationale
- Custom controls need access to the actual rasterization scale in order to render sharply.
- Custom controls should function independently of the parent container they reside in.
- Implementing a workaround at the ScrollViewer level—such as updating all child controls when ViewChanged occurs—not only requires adding extra APIs to the controls, but also involves traversing all children within the ScrollViewer, which leads to poor performance. Additionally, it forces control consumers to write boilerplate code for something that should be handled by the platform itself.
### Scope
| Capability | Priority |
| :---------- | :------- |
| This proposal will allow developers to develop drawn controls which render ok inside ScrollViewer | Must |
### Important Notes
_No response_
### Open Questions
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Visual element and Composition API behavior described in the proposal, especially how ScrollViewer zooming affects rasterization scale. Determine the supported event or notification design and how custom controls would receive the actual scale; done means custom drawings can be notified and rerender sharply during zoom operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100