Skip to content

Commit e34e9eb

Browse files
committed
Fixed Marquee for UWP
1 parent 4244212 commit e34e9eb

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

components/Marquee/src/Marquee.cs

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private void PlayMarquee(bool fromStart = false)
239239
private void UpdateMarquee(bool onTheFly)
240240
{
241241
// Check for crucial template parts
242-
if(!HasTemplateParts())
242+
if (_marqueeTransform is null)
243243
return;
244244

245245
// If the update cannot be made on the fly,
@@ -278,14 +278,21 @@ private void UpdateMarquee(bool onTheFly)
278278
/// <param name="seekPoint">The seek point to resume the animation (if possible or appropriate.</param>
279279
/// <exception cref="InvalidOperationException">Thrown when template parts are not supplied.</exception>
280280
/// <returns>Returns whether or not an animation is neccesary.</returns>
281-
[MemberNotNullWhen(true, nameof(_marqueeStoryboard))]
282281
private bool UpdateAnimation(out TimeSpan seekPoint)
283282
{
284283
seekPoint = TimeSpan.Zero;
285284

286285
// Check for crucial template parts
287-
if (!HasTemplateParts())
286+
if (_marqueeContainer is null ||
287+
_marqueeTransform is null ||
288+
_segment1 is null ||
289+
_segment2 is null)
290+
{
291+
// Crucial template parts are missing!
292+
// This can happen during initialization of certain properties.
293+
// Gracefully return when this happens. Proper checks for these template parts happen in OnApplyTemplate.
288294
return false;
295+
}
289296

290297
// Unbind events from the old storyboard
291298
if (_marqueeStoryboard is not null)
@@ -447,21 +454,4 @@ private Storyboard CreateMarqueeStoryboardAnimation(double start, double end, Ti
447454

448455
return marqueeStoryboard;
449456
}
450-
451-
[MemberNotNullWhen(true, nameof(_marqueeContainer), nameof(_marqueeTransform), nameof(_segment1), nameof(_segment2))]
452-
private bool HasTemplateParts()
453-
{
454-
if (_marqueeContainer is null ||
455-
_marqueeTransform is null ||
456-
_segment1 is null ||
457-
_segment2 is null)
458-
{
459-
// Crucial template parts are missing!
460-
// This can happen during initialization of certain properties.
461-
// Gracefully return when this happens. Proper checks for these template parts happen in OnApplyTemplate.
462-
return false;
463-
}
464-
465-
return true;
466-
}
467457
}

0 commit comments

Comments
 (0)