Skip to content

Commit b7b17cb

Browse files
author
tznind
committed
Fix adornment detection
1 parent e09aa54 commit b7b17cb

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/ViewExtensions.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,7 @@ private static bool HasNoBorderProperty(this View v)
448448

449449
/// <summary>
450450
/// Returns <see langword="true"/> if <paramref name="v"/> is part of
451-
/// a <see cref="Adornment"/> (either directly or embedded sub view of
452-
/// one - e.g. <see cref="ShadowView"/>).
451+
/// an Adornment (either directly or embedded sub view of one - e.g. <see cref="ShadowView"/>).
453452
/// </summary>
454453
/// <param name="v"></param>
455454
/// <returns></returns>
@@ -482,8 +481,8 @@ public static bool AnySuperViewIs<T>(this View v) where T : View
482481
}
483482

484483
/// <summary>
485-
/// Returns the <see cref="Adornment.Parent"/> of <paramref name="v"/>
486-
/// if it is an <see cref="Adornment"/>. Or if <paramref name="v"/> is not
484+
/// Returns the <see cref="IAdornment.Parent"/> of <paramref name="v"/>
485+
/// if it is an <see cref="AdornmentView"/>. Or if <paramref name="v"/> is not
487486
/// directly an adornment but <see cref="AnySuperViewIs{T}"/> then the method
488487
/// will traverse up <see cref="View.SuperView"/> hierarchy until parent is found.
489488
/// </summary>
@@ -493,12 +492,11 @@ public static bool AnySuperViewIs<T>(this View v) where T : View
493492
{
494493
while (v != null)
495494
{
496-
if (v is AdornmentView a)
495+
if(v is AdornmentView av)
497496
{
498-
return a.SuperView;
497+
return av.Adornment?.Parent;
499498
}
500499

501-
//
502500
v = v.SuperView;
503501
}
504502

0 commit comments

Comments
 (0)