Repository navigation
Make Add/Remove Logical public - #16046
Merged
Merged
Conversation
PureWeen
force-pushed
the
make_add_remove_logical_public
branch
from
July 10, 2023 19:13
12eb69d to
63e60b4
Compare
PureWeen
marked this pull request as ready for review
July 10, 2023 21:44
PureWeen
requested review from
StephaneDelcroix,
drasticactions,
hartez and
mattleibow
July 10, 2023 22:53
PureWeen
force-pushed
the
make_add_remove_logical_public
branch
2 times, most recently
from
July 13, 2023 02:54
74a0423 to
91ee26c
Compare
PureWeen
commented
Jul 13, 2023
| frame = collectionView.Frame; | ||
|
|
||
| #if WINDOWS | ||
| #if WINDOWS || ANDROID |
Member
Author
There was a problem hiding this comment.
This PR adds a slightly longer delay to OnLoaded this gives Android a little more time which causes an OnMeasure loop to now fire on the ContentPage before these tests start running. Because of this, Android also needs this wait.
MartyIX
reviewed
Jul 17, 2023
PureWeen
force-pushed
the
make_add_remove_logical_public
branch
from
July 17, 2023 21:12
38f77ec to
9e13593
Compare
mattleibow
reviewed
Jul 18, 2023
mattleibow
left a comment
Member
There was a problem hiding this comment.
This is looking really good - makes me so happy to remove all the internal magic!
PureWeen
force-pushed
the
make_add_remove_logical_public
branch
from
July 18, 2023 17:46
f03cda9 to
ced4dfa
Compare
mattleibow
approved these changes
Jul 18, 2023
MartyIX
reviewed
Jul 18, 2023
|
|
||
| internal void ClearLogicalChildren() | ||
| /// <summary> | ||
| /// Removes all <see cref="Element"/>s. |
Contributor
There was a problem hiding this comment.
Suggested change
| /// Removes all <see cref="Element"/>s. | |
| /// Removes all <see cref="Element"/>s. |
MartyIX
reviewed
Jul 18, 2023
| void OnVisualTreeChanged(object? sender, VisualTreeChangeEventArgs e) | ||
| { | ||
| Assert.True(e.ChildIndex >= 0, "Visual Tree inaccurate when OnVisualTreeChanged called"); | ||
| Assert.True(e.ChildIndex >= 0,$"Visual Tree inaccurate when OnVisualTreeChanged called. ChildIndex: {e.ChildIndex}"); |
Contributor
There was a problem hiding this comment.
Suggested change
| Assert.True(e.ChildIndex >= 0,$"Visual Tree inaccurate when OnVisualTreeChanged called. ChildIndex: {e.ChildIndex}"); | |
| Assert.True(e.ChildIndex >= 0, $"Visual Tree inaccurate when OnVisualTreeChanged called. ChildIndex: {e.ChildIndex}"); |
This was referenced Jul 21, 2023
2 tasks done
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Adds a set of APIs (AddLogicalChild, RemoveLogicalChild, ClearLogicalChildren, InsertLogicalChild) to streamline our setup of parent/child relationships and also allow for outside developers to opt into the benefits of becoming a logical child.
Expose a set of public APIs on
Elementthat allow users to add/remove logical children to anyElement. There are a number of features we have that rely onLogicalChildren: LiveVisualTree, HotReload, Style propagation, etc. TheLogicalChildrenstructure is currently closed off from the outside world. If someone implements a custom control based off ofElement, there's not really an easy way for them to setupLogicalChildren. This makes it almost impossible for 3rd party controls to setup a proper hierarchy that will benefit from LiveVisualTree, HotReload, Style propagation, BC propagation, etc.Rework internal code to use these new APIs
Examples
For example, the MCT has a
popupcontrol that lives on aPage. Because that popup can't add itself to theLogicalChidlrenof aPagethepopupcontrol doesn't work with Hot Reload or Live Visual TreeCommunityToolkit/Maui#1168
fixes #3745
fixes #15760