-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TemplatePartAttribute for Controls #7432
Comments
WinUI is now doing something interesting with template parts. Enums are generated for the named parts and then 'magic' strings are removed from code usage. First example I saw: https://github.com/microsoft/microsoft-ui-xaml/blob/2a6d2d69c809c141ca7916c9730fd5305487501e/dev/TeachingTip/TeachingTipTemplatePartHelpers.h |
I wasn't really thought about code generation, it sounds like a good argument to have this attribute even without support IDE support. |
Neither did I until I noticed what WinUI is doing recently. |
Created ticket in Rider's YouTrack - https://youtrack.jetbrains.com/issue/RSRP-488276 |
Well, WPF has been on life support for years now. I can understand they didn't want to invest much. I was already surprised they did full Avalonia support so this has a better chance in my opinion. Separately, I'll probably add the attributes for all templated controls with a style XAML file next weekend. I imagine I'm going to find naming issues as well (missing PART_ prefix) and we'll have to discuss if a breaking change is worth it. 11.0 is the best time to do this though. |
Is your feature request related to a problem? Please describe.
Named parts in control templates are not always clear to control authors, designers and other IDE tooling.
Describe the solution you'd like
WPF has the TemplatePart attribute used with templated controls. This indicates the named parts of the template, and their type, that are used within code-behind. This information was historically used in designers (Blend) as well as with automated checks to ensure default styles and their templates are complete.
This TemplatePart attribute should be added to avalonia and used for all controls (example from WPF). This should be used for all elements that start with the "PART_" prefix in the name.
Describe alternatives you've considered
The alternative is no attribute at all as currently exists.
Additional context
Information for PseuodClasses is provided in another attribute. This one should be included as well for completeness.
The text was updated successfully, but these errors were encountered: