diff --git a/src/Controls/src/Core/Border/Border.cs b/src/Controls/src/Core/Border/Border.cs index 2ac3f7ba4380..570f1c93d1e0 100644 --- a/src/Controls/src/Core/Border/Border.cs +++ b/src/Controls/src/Core/Border/Border.cs @@ -64,13 +64,10 @@ void NotifyStrokeShapeChanges() if (strokeShape is VisualElement visualElement) { - SetInheritedBindingContext(visualElement, BindingContext); + AddLogicalChild(visualElement); _strokeShapeChanged ??= (sender, e) => OnPropertyChanged(nameof(StrokeShape)); _strokeShapeProxy ??= new(); _strokeShapeProxy.Subscribe(visualElement, _strokeShapeChanged); - - OnParentResourcesChanged(this.GetMergedResources()); - ((IElementDefinition)this).AddResourcesChangedListener(visualElement.OnParentResourcesChanged); } } @@ -80,9 +77,7 @@ void StopNotifyingStrokeShapeChanges() if (strokeShape is VisualElement visualElement) { - ((IElementDefinition)this).RemoveResourcesChangedListener(visualElement.OnParentResourcesChanged); - - SetInheritedBindingContext(visualElement, null); + RemoveLogicalChild(visualElement); _strokeShapeProxy?.Unsubscribe(); } }