提交 3acac122 编写于 作者: D David

chore: Make sure that all visual has valid comment in debug

上级 b9c2f558
...@@ -31,6 +31,14 @@ namespace Windows.UI.Xaml.Controls ...@@ -31,6 +31,14 @@ namespace Windows.UI.Xaml.Controls
Visual.Children.InsertAtBottom(_textVisual); Visual.Children.InsertAtBottom(_textVisual);
} }
#if DEBUG
private protected override void OnLoaded()
{
base.OnLoaded();
_textVisual.Comment = $"{Visual.Comment}#text";
}
#endif
protected override Size MeasureOverride(Size availableSize) protected override Size MeasureOverride(Size availableSize)
{ {
var padding = Padding; var padding = Padding;
......
...@@ -68,6 +68,8 @@ namespace Windows.UI.Xaml ...@@ -68,6 +68,8 @@ namespace Windows.UI.Xaml
visualTreeRoot.OnElementUnloaded(); visualTreeRoot.OnElementUnloaded();
} }
partial void OnLoading();
// Overloads for the FrameworkElement to raise the events // Overloads for the FrameworkElement to raise the events
// (Load/Unload is actually a concept of the FwElement, but it's easier to handle it directly from the UIElement) // (Load/Unload is actually a concept of the FwElement, but it's easier to handle it directly from the UIElement)
private protected virtual void OnFwEltLoading() { } private protected virtual void OnFwEltLoading() { }
...@@ -85,6 +87,7 @@ namespace Windows.UI.Xaml ...@@ -85,6 +87,7 @@ namespace Windows.UI.Xaml
IsLoading = true; IsLoading = true;
Depth = depth; Depth = depth;
OnLoading();
OnFwEltLoading(); OnFwEltLoading();
// Explicit propagation of the loading even must be performed // Explicit propagation of the loading even must be performed
......
...@@ -81,7 +81,7 @@ namespace Windows.UI.Xaml ...@@ -81,7 +81,7 @@ namespace Windows.UI.Xaml
{ {
_visual = Window.Current.Compositor.CreateShapeVisual(); _visual = Window.Current.Compositor.CreateShapeVisual();
#if ENABLE_CONTAINER_VISUAL_TRACKING #if ENABLE_CONTAINER_VISUAL_TRACKING
_visual.Comment = $"Owner: {this.GetDebugDepth():D2}-{this.GetDebugName()}"; _visual.Comment = $"{this.GetDebugDepth():D2}-{this.GetDebugName()}";
#endif #endif
} }
...@@ -89,6 +89,16 @@ namespace Windows.UI.Xaml ...@@ -89,6 +89,16 @@ namespace Windows.UI.Xaml
} }
} }
#if ENABLE_CONTAINER_VISUAL_TRACKING // Make sure to update the Comment to have the valid depth
partial void OnLoading()
{
if (_visual is not null)
{
_visual.Comment = $"{this.GetDebugDepth():D2}-{this.GetDebugName()}";
}
}
#endif
internal bool ClippingIsSetByCornerRadius { get; set; } internal bool ClippingIsSetByCornerRadius { get; set; }
public void AddChild(UIElement child, int? index = null) public void AddChild(UIElement child, int? index = null)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册