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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add Binding to DataTemplates docs #2292

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

Conversation

eriklimakc
Copy link
Contributor

@eriklimakc eriklimakc commented May 14, 2024

GitHub Issue (If applicable): closes #679

PR Type

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

Other information

Internal Issue (If applicable):

@eriklimakc eriklimakc force-pushed the dev/erli/csm-datatemplate-binding branch from 05314c1 to 4258557 Compare May 14, 2024 18:03
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
@eriklimakc eriklimakc self-assigned this May 16, 2024
@eriklimakc eriklimakc marked this pull request as ready for review May 16, 2024 09:14
@eriklimakc eriklimakc requested a review from agneszitte May 16, 2024 09:14
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
@agneszitte
Copy link
Contributor

@Mergifyio backport release/stable/4.1

Copy link

mergify bot commented May 17, 2024

backport release/stable/4.1

🟠 Waiting for conditions to match

  • merged [📌 backport requirement]

@agneszitte agneszitte requested a review from Xiaoy312 May 28, 2024 19:08
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
doc/Learn/Markup/Binding-To-DataTemplates.md Outdated Show resolved Hide resolved
@agneszitte
Copy link
Contributor

@dansiegel, @nickrandolph if you can give a last review before we merge please

private Button CreateRemoveButton() => new Button()
.Content("Delete")
.CommandParameter(x => x
.RelativeSource<Button>(RelativeSourceMode.TemplatedParent)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an inconsistency issue here:

RelativeSource as TemplatedParent works on Windows but not on Uno
RelativeSource as Self works on Uno but not on Windows

Should be fixed by unoplatform/uno#12732

@dansiegel @Xiaoy312 @agneszitte

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eriklimakc @dansiegel I'm not sure what this example is supposed to demonstrate? Is this supposed to be the equivalent of CommandParameter="{Binding }" in XAML?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I believe it is how you would accomplish CommandParameter="{Binding }" when you are in an extracted method that doesn't have a reference to the datacontext

Copy link
Contributor Author

@eriklimakc eriklimakc Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's to achieve what @kazo0 mentioned and in the next example we also mention the possiblity of doing .CommandParameter(x => x.Binding()) to have the same result without RelativeSource.

@kazo0
Copy link
Contributor

kazo0 commented Sep 6, 2024

@eriklimakc is this PR still needed, are we waiting on something before it can be ready to merge?

@eriklimakc
Copy link
Contributor Author

@eriklimakc is this PR still needed, are we waiting on something before it can be ready to merge?

@kazo0 this PR is waiting for the templated-parent rework that Xiao is working on unoplatform/uno#17645 to have this fixed #2292 (comment)

@eriklimakc
Copy link
Contributor Author

This may be unblocked now that unoplatform/uno#17645 was merged.

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.

Quick samples in both XAML and C# Markup that shows how to call commands + parameters inside an ItemTemplate
5 participants