Граф коммитов

4 Коммитов

Автор SHA1 Сообщение Дата
Rui Marinho 79cc0f49fe
Major code format (#12254) 2020-09-29 11:15:44 +01:00
Peter Moore 16cdd280e8 RelativeSource Binding Bug Fixes (Gh8450) (#8541)
* RelativeSource Binding Bug FIxes

(1) Fix RelativeSource-FindAncestorBindingContext bindings not re-applying on ancestor BindingContext or ancestry changes; 
(2) fix incorrect interpretation of AncestorLevel; 
(3) much more robust unit tests for RelativeSource ancestor-type binding (#4)

* Update Xamarin.Forms.Core.UnitTests/RelativeSourceBindingTests.cs

Co-Authored-By: Samantha Houts <samhouts@users.noreply.github.com>
Fixes #8450
2019-11-21 16:21:33 -08:00
Stephane Delcroix 9c5e6f256e
[C] Fix TemplateBinding for non-logicalchildren (#7506)
Spans, e.g., are no LogicalChildren of FormattedString, which is not a
LogicalChildren of Label. The newly introduced way of propagating the
TemplatedParent was top-down, using LogicalChildren, was not assigning
the correct TemplatedParent on Spans.

This reverts to a bottom-up lookup, hooking on ParentSet, like it used to
be.

As a side effect, the TemplateBindings are no longer updated on reparenting,
but this was the original behavior, and I can't think of a case where this
would be needed.

The regression to `{TemplateBinding}` was introduced by #4375.

- fixes #7494
2019-09-19 12:33:32 +02:00
Peter Moore fa853ff823 RelativeSource Binding (#4375)
RelativeSource Binding

- fixes #3847

Implement RelativeSource binding modes for Self, TemplatedParent, and FindAncestor. Add unit tests. Pare down TemplateBinding class to use RelativeSource binding mechanism.

* Include RelativeSource member in Binding.Clone

* Fix issue of unit tests being tricked by async in Binding.Apply; permit "Source={RelativeSource...}" in addition to "RelativeSource={RelativeSource..."; allow FindAncestor relative binding source mode to be based on BindingContext type or control type

* Fix unit test wasn't actually testing "Source={RelativeSource...}" syntax.

* Address @StephaneDelcroix's comments. Make FindAncestor relative source binding work even when the ancestor changes.

* Much better mechanism for detecting when a parent changes for relativesource

* Cleanup

* more cleanup

* more cleanup

* Remove async/await for identifying templated parent and ancestor type binding source

* Remove unused code; fix linting

* Update Xamarin.Forms.Core/Binding.cs

Co-Authored-By: Stephane Delcroix <stephane@delcroix.org>

* Update Xamarin.Forms.Core/Binding.cs

Co-Authored-By: Stephane Delcroix <stephane@delcroix.org>

* Update Xamarin.Forms.Core/Binding.cs

Co-Authored-By: Stephane Delcroix <stephane@delcroix.org>

* Update Xamarin.Forms.Core/BindingExpression.cs

Co-Authored-By: Stephane Delcroix <stephane@delcroix.org>

* Update Xamarin.Forms.Core/BindingExpression.cs

Co-Authored-By: Stephane Delcroix <stephane@delcroix.org>

* Update Xamarin.Forms.Core/Binding.cs

Co-Authored-By: Stephane Delcroix <stephane@delcroix.org>

* Ensure TemplateBinding works correctly when reparenting. Cleanup.

* Finish addressing comments; linting cleanup

* Remove private modifier where unneeded
2019-07-09 12:10:13 +02:00