-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make Add/Remove Logical public #16046
Conversation
12eb69d
to
63e60b4
Compare
74a0423
to
91ee26c
Compare
@@ -143,7 +143,7 @@ public async Task CollectionViewCanSizeToContent(CollectionViewSizingTestCase te | |||
await WaitForUIUpdate(frame, collectionView); | |||
frame = collectionView.Frame; | |||
|
|||
#if WINDOWS | |||
#if WINDOWS || ANDROID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
38f77ec
to
9e13593
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good - makes me so happy to remove all the internal magic!
src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.cs
Show resolved
Hide resolved
f03cda9
to
ced4dfa
Compare
|
||
return true; | ||
} | ||
|
||
internal void ClearLogicalChildren() | ||
/// <summary> | ||
/// Removes all <see cref="Element"/>s. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Removes all <see cref="Element"/>s. | |
/// Removes all <see cref="Element"/>s. |
@@ -26,7 +26,7 @@ public void Dispose() | |||
|
|||
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}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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}"); |
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
Element
that 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. TheLogicalChildren
structure 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
popup
control that lives on aPage
. Because that popup can't add itself to theLogicalChidlren
of aPage
thepopup
control doesn't work with Hot Reload or Live Visual TreeCommunityToolkit/Maui#1168
fixes #3745
fixes #15760