Skip to content

Commit

Permalink
Add Viewbox to VisualTreeExtensions FindChild branches
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-hawker committed Jul 20, 2021
1 parent 8a5ae96 commit 16f70bf
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,20 @@ public static partial class FrameworkElementExtensions
goto Start;
}
}
else if (element is Viewbox viewbox)
{
if (viewbox.Child is FrameworkElement child)
{
if (child is T result && predicate.Match(result))
{
return result;
}

element = child;

goto Start;
}
}
else if (element is UserControl userControl)
{
// We put UserControl right before the slower reflection fallback path as
Expand Down Expand Up @@ -398,6 +412,17 @@ public static IEnumerable<FrameworkElement> FindChildren(this FrameworkElement e
goto Start;
}
}
else if (element is Viewbox viewbox)
{
if (viewbox.Child is FrameworkElement child)
{
yield return child;

element = child;

goto Start;
}
}
else if (element is UserControl userControl)
{
if (userControl.Content is FrameworkElement content)
Expand Down

0 comments on commit 16f70bf

Please sign in to comment.