Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Core/src/Platform/Windows/WrapperView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public WrapperView()
Children.Add(_borderPath);
}

long _visibilityDependencyPropertyCallbackToken;
public FrameworkElement? Child
{
get { return _child; }
Expand All @@ -41,6 +42,7 @@ internal set
if (_child != null)
{
_child.SizeChanged -= OnChildSizeChanged;
_child.UnregisterPropertyChangedCallback(VisibilityProperty, _visibilityDependencyPropertyCallbackToken);
Children.Remove(_child);
}

Expand All @@ -49,6 +51,7 @@ internal set

_child = value;
_child.SizeChanged += OnChildSizeChanged;
_visibilityDependencyPropertyCallbackToken = _child.RegisterPropertyChangedCallback(VisibilityProperty, OnChildVisibilityChanged);
Children.Add(_child);
}
}
Expand Down Expand Up @@ -142,6 +145,16 @@ void OnChildSizeChanged(object sender, SizeChangedEventArgs e)
UpdateShadow();
}

void OnChildVisibilityChanged(DependencyObject sender, DependencyProperty dp)
{
// OnChildSizeChanged does not fire for Visibility changes to child
if (sender is FrameworkElement child && _shadowCanvas.Children.Count > 0)
{
var shadowHost = _shadowCanvas.Children[0];
shadowHost.Visibility = child.Visibility;
}
}

void DisposeShadow()
{
if (_shadowCanvas == null)
Expand Down