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

TemplateBinding and TemplatedParent Binding return different values (UnsetValue vs null) on failure to resolve #1048

Closed
HppZ opened this issue Jul 13, 2019 · 10 comments
Assignees
Labels
area-Binding team-Markup Issue for the Markup team

Comments

@HppZ
Copy link

HppZ commented Jul 13, 2019

using TemplateBinding in VisualState.Setters will make app crash while using TemplatedParent won't.

@HppZ HppZ added the question label Jul 13, 2019
@jevansaks
Copy link
Member

jevansaks commented Jul 15, 2019

They should be behaviorally equivalent, with the Binding to TemplateParent enabling more complex paths and converters. But I wouldn't have expected TemplateBinding to crash. What is the call stack and error message you see? (you would need to enable native debugging and break on first chance WinRT originate error).

@evelynwu-msft
Copy link
Contributor

@HppZ if you could provide a repro project that would be ideal as it would ensure that we are investigating the right thing.

@HppZ
Copy link
Author

HppZ commented Jul 15, 2019

@evelynwu-msft
Copy link
Contributor

evelynwu-msft commented Jul 16, 2019

Thanks for the repro! So it seems like your template binding (whether as {TemplateBinding} or {Binding RelativeSource={RelativeSource TemplatedParent}}) doesn't resolve to a value. However, there is a subtle difference in what the two markup expressions return: in the former case it's unset value whereas in the latter case it's null. VSM setters raise an error (when a debugger is attached) if Setter.Value is unset value, but null is considered a valid value.

Having said that, starting with the 1903 release VSM Setters should be permitting unset value on Setter.Value, so I suspect we have a bug of the backwards-logic sort in the framework. I would also expect your binding to successfully resolve, so that's probably a bug as well.

@HppZ
Copy link
Author

HppZ commented Jul 16, 2019

since it is a bug, please fix it, thanks!

@fabiant3-zz fabiant3-zz changed the title Question: difference between TemplateBinding & TemplatedParent Using TemplateBinding in VisualState.Setters will make app crash while using TemplatedParent won't Jul 24, 2019
@fabiant3-zz
Copy link

Changed title, we'll be considering this issue in the future (bug, not a question anymore). Thanks for reporting and providing the sample code HppZ!

@evelynwu-msft evelynwu-msft changed the title Using TemplateBinding in VisualState.Setters will make app crash while using TemplatedParent won't TemplateBinding and TemplatedParent Binding return different values (UnsetValue vs null) on failure to resolve Jul 25, 2019
@evelynwu-msft
Copy link
Contributor

Created issues #1104 and #1105 to track different aspects of the overall reported failure.

@jevansaks jevansaks added the team-Markup Issue for the Markup team label Nov 7, 2019
@marcelwgn
Copy link
Contributor

@StephenLPeters Should this be marked as WinUI 3 since this is currently part of OS XAML?

@StephenLPeters
Copy link
Contributor

I think it should actually just be closed, Winui 3 wont have OS version specific code and from the comments it looks like this was fixed in 1903 so it should already be fixed in Winui 3. @alwu-msft can you confirm and close?

@anawishnoff
Copy link
Contributor

This issue should be fixed as of the latest Windows App SDK 0.8 release, so I'm closing this. Let me know if it still persists and we can re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Binding team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

8 participants