Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: TemplatedParent rework #12732

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Xiaoy312
Copy link
Contributor

@Xiaoy312 Xiaoy312 commented Jun 27, 2023

GitHub Issue (If applicable): closes #1621, closes #12624

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

todo

What is the new behavior?

todo

Copilot Summary

馃 Generated by Copilot at 4f37e52

This pull request adds support for template bindings, which allow bindings to use the templated parent as the source. It modifies the BindingExpression, Binding, ControlTemplate, DataTemplate, ItemsPanelTemplate, and Control classes to handle the templated parent scope and pass it to the bindings. It also adds a new class TemplateParentResolver to create and manage the templated parent scopes.

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

src/Uno.UI/UI/Xaml/FrameworkTemplate.cs Outdated Show resolved Hide resolved
src/Uno.UI/DataBinding/BindingExpression.cs Outdated Show resolved Hide resolved
src/Uno.UI/UI/Xaml/TemplateParentResolver.cs Outdated Show resolved Hide resolved
@Xiaoy312
Copy link
Contributor Author

Xiaoy312 commented Jun 27, 2023

to be reworked completely...
we should be modifying the generated xaml and the xaml parsing side
instead of correcting {TemplateBinding} between ControlTemplate materialization

@Xiaoy312 Xiaoy312 closed this Jun 27, 2023
@Xiaoy312
Copy link
Contributor Author

Xiaoy312 commented Jun 28, 2023

after reviewing the approach, it was made clear that it is easier to maintain the global stack and inject the parent on BindingExpression.ctor
than to adjust the whole call chain (which touches source-gen + xamlreader and some of the unified parts)
plus even then, the other approach would still requires a global stack for the info (as that would be the only way, that I know of)
so the parent being injected earlier or later made near no difference at all.


todo:

  • templated parent rework
    • XamlCodeGenerator
    • XamlReader.Load
  • write test cases against common scenarios
  • adjust code around template recycling
  • validate native control presenter tp propagation
  • polish & clean up debug code
  • rebase & sanity check

@Xiaoy312 Xiaoy312 reopened this Jun 28, 2023
@Xiaoy312 Xiaoy312 force-pushed the dev/xygu/20230626/templatebinding branch from 4f37e52 to 1074ab0 Compare July 3, 2023 10:19
@github-actions github-actions bot added platform/ios 馃崕 Categorizes an issue or PR as relevant to the iOS platform area/code-generation Categorizes an issue or PR as relevant to code generation labels Jul 3, 2023
@Xiaoy312 Xiaoy312 force-pushed the dev/xygu/20230626/templatebinding branch from 1074ab0 to c15e40a Compare July 3, 2023 10:38
@Xiaoy312 Xiaoy312 removed the platform/ios 馃崕 Categorizes an issue or PR as relevant to the iOS platform label Jul 20, 2023
@github-actions github-actions bot added platform/ios 馃崕 Categorizes an issue or PR as relevant to the iOS platform area/automation Categorizes an issue or PR as relevant to project automation labels Jul 27, 2023
@Xiaoy312 Xiaoy312 changed the title fix: TemplateBinding inheriting incorrect TemplatedParent refactor!: TemplatedParent rework Jul 28, 2023
@Xiaoy312 Xiaoy312 added area/xaml-reader Categorizes an issue or PR as relevant to the XAML Reader and removed platform/ios 馃崕 Categorizes an issue or PR as relevant to the iOS platform area/automation Categorizes an issue or PR as relevant to project automation labels Jul 28, 2023
@Xiaoy312 Xiaoy312 force-pushed the dev/xygu/20230626/templatebinding branch from 08853b3 to 4196f29 Compare July 28, 2023 17:31
@github-actions github-actions bot added platform/ios 馃崕 Categorizes an issue or PR as relevant to the iOS platform area/automation Categorizes an issue or PR as relevant to project automation labels Jul 28, 2023
@Xiaoy312 Xiaoy312 force-pushed the dev/xygu/20230626/templatebinding branch from 4196f29 to 7a7d571 Compare July 28, 2023 17:42
@Xiaoy312 Xiaoy312 force-pushed the dev/xygu/20230626/templatebinding branch from 7a7d571 to 9cf4a78 Compare July 28, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/automation Categorizes an issue or PR as relevant to project automation area/code-generation Categorizes an issue or PR as relevant to code generation area/xaml-reader Categorizes an issue or PR as relevant to the XAML Reader platform/ios 馃崕 Categorizes an issue or PR as relevant to the iOS platform
Projects
None yet
2 participants