Skip to content

Commit 2fe411d

Browse files
Add Viewbox to VisualTreeExtensions FindChild branches
1 parent d996cb5 commit 2fe411d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.LogicalTree.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,20 @@ public static partial class FrameworkElementExtensions
196196
goto Start;
197197
}
198198
}
199+
else if (element is Viewbox viewbox)
200+
{
201+
if (viewbox.Child is FrameworkElement child)
202+
{
203+
if (child is T result && predicate.Match(result))
204+
{
205+
return result;
206+
}
207+
208+
element = child;
209+
210+
goto Start;
211+
}
212+
}
199213
else if (element is UserControl userControl)
200214
{
201215
// We put UserControl right before the slower reflection fallback path as
@@ -398,6 +412,17 @@ public static IEnumerable<FrameworkElement> FindChildren(this FrameworkElement e
398412
goto Start;
399413
}
400414
}
415+
else if (element is Viewbox viewbox)
416+
{
417+
if (viewbox.Child is FrameworkElement child)
418+
{
419+
yield return child;
420+
421+
element = child;
422+
423+
goto Start;
424+
}
425+
}
401426
else if (element is UserControl userControl)
402427
{
403428
if (userControl.Content is FrameworkElement content)

0 commit comments

Comments
 (0)