Skip to content

Conversation

@michael-hawker
Copy link
Member

@michael-hawker michael-hawker commented Nov 19, 2025

See discussion for more details: #278

This is my modern Adorners implementation that I started a few years ago, originally here: https://github.com/michael-hawker/Labs-Windows/tree/llama/adorners/labs/Adorners

Since that was in a prior iteration of Labs, I've brought it over atop a new component template base, as well as merging in updates from XAML Studio where I've been using this a bit more already in practical scenarios.

Currently only works for UWP, debugging issue with Windows App SDK... (It used to work here I'm pretty sure, so not sure what's going on, more discussion on Discord: https://discord.com/channels/372137812037730304/672911467401445377/1440605732276801537) - Fixed, thanks @ahmed605!

TODO:

  • Handle Windows resizing positioning (most recent update to unblock this!)
  • Add some WPF migration notes
    • Add more once Adorner helper is in
  • Add Adorner base class/helper
  • Add some more examples (thought of a good example to try building as TODO)
  • Get working with Windows App SDK again

Open Questions (may not be handled in initial PR):

  • Handle AdornedElement unloading
    • Maybe visibility to? (little worried about overwriting dev set value if managed independently, could check if unset...)
  • Do we provide a helper (maybe using the existing toolkit extension) for IsClipEnabled?
  • Do we provide a hook to the positioning with similar GetDesiredTransform? (Should we use transform over Canvas coordinates?)

Demo video showing animations with an InfoBadge on a TabViewItem:

XAMLAdornerAnimations.mp4

"Squarer" video with data binding:

XAMLAdornerAnimations2.mp4

michael-hawker and others added 11 commits November 18, 2025 12:30
Original Branch: https://github.com/michael-hawker/Labs-Windows/tree/llama/adorners/labs/Adorners
(This was on an older interation of Labs infrastructure, so would make rebasing/updating branch difficult, easier to just start new component and copy over.)
Only changes were to modernize atop latest Toolkit packages instead of including copied helper code.
Have more updates to build atop this from XAML Studio after, plus some new updates to API surface, and docs for WPF comparisons.
…ass extension for FrameworkElementExtensions
Includes initial support for adorners to adjust to window/content resizing
Co-authored-by: Ahmed <[email protected]>
I had missed the warning from CsWinRT, big thanks to @ahmed605 for helping debug this issue in the Windows App Community Discord!
…th `AdornerLayer` and customization point

Add extra info about this to the doc
TODO: need to test passing in a custom/subclassed Adorner still
TODO: Need to handle the Tab closing (i.e. AdornedElement unloads/disappears should also detach/remove adorner from AdornerLayer)
@michael-hawker
Copy link
Member Author

TabView sample is cool, it works great as there's a ScrollViewer within the tabstrip, it's magic. Though removing the tab dynamically leaves the adorner, so definitely adding handling in the new Adorner container/wrapper for Visibility/Unloaded events will be good. (Much easier to do now at least with latest change introducing the Adorner class.)

I want to add a custom adorner sample, seeing how hard it'd be to do a resizer sort of helper (akin to the ImageCropper control [should look how it did it to compare]).

There's a lot of custom Adorner stuff I was looking at in XAML Studio, so I want to pull this in there to test and muck about with how I think this works now and see if it is easy to use... 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant