Skip to content
28 changes: 21 additions & 7 deletions components/Animations/src/Extensions/CompositorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ public static BooleanKeyFrameAnimation CreateBooleanKeyFrameAnimation(
animation.InsertKeyFrame(0, from.Value);
}

animation.Target = target;
if (target is not null)
animation.Target = target;

animation.Direction = direction;
animation.IterationBehavior = iterationBehavior;
animation.IterationCount = iterationCount;
Expand Down Expand Up @@ -170,7 +172,9 @@ public static ScalarKeyFrameAnimation CreateScalarKeyFrameAnimation(
animation.InsertKeyFrame(0, from.Value);
}

animation.Target = target;
if (target is not null)
animation.Target = target;

animation.Direction = direction;
animation.IterationBehavior = iterationBehavior;
animation.IterationCount = iterationCount;
Expand Down Expand Up @@ -231,7 +235,9 @@ public static Vector2KeyFrameAnimation CreateVector2KeyFrameAnimation(
animation.InsertKeyFrame(0, from.Value);
}

animation.Target = target;
if (target is not null)
animation.Target = target;

animation.Direction = direction;
animation.IterationBehavior = iterationBehavior;
animation.IterationCount = iterationCount;
Expand Down Expand Up @@ -292,7 +298,9 @@ public static Vector3KeyFrameAnimation CreateVector3KeyFrameAnimation(
animation.InsertKeyFrame(0, from.Value);
}

animation.Target = target;
if (target is not null)
animation.Target = target;

animation.Direction = direction;
animation.IterationBehavior = iterationBehavior;
animation.IterationCount = iterationCount;
Expand Down Expand Up @@ -353,7 +361,9 @@ public static Vector4KeyFrameAnimation CreateVector4KeyFrameAnimation(
animation.InsertKeyFrame(0, from.Value);
}

animation.Target = target;
if (target is not null)
animation.Target = target;

animation.Direction = direction;
animation.IterationBehavior = iterationBehavior;
animation.IterationCount = iterationCount;
Expand Down Expand Up @@ -414,7 +424,9 @@ public static ColorKeyFrameAnimation CreateColorKeyFrameAnimation(
animation.InsertKeyFrame(0, from.Value);
}

animation.Target = target;
if (target is not null)
animation.Target = target;

animation.Direction = direction;
animation.IterationBehavior = iterationBehavior;
animation.IterationCount = iterationCount;
Expand Down Expand Up @@ -475,7 +487,9 @@ public static QuaternionKeyFrameAnimation CreateQuaternionKeyFrameAnimation(
animation.InsertKeyFrame(0, from.Value);
}

animation.Target = target;
if (target is not null)
animation.Target = target;

animation.Direction = direction;
animation.IterationBehavior = iterationBehavior;
animation.IterationCount = iterationCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ private static void Element_PointerEntered(object sender, PointerRoutedEventArgs
CursorShape cursor = GetCursor((FrameworkElement)sender);

#if !WINAPPSDK
if (Window.Current?.CoreWindow is not null)
Window.Current.CoreWindow.PointerCursor = _cursors[cursor];
#endif
}
Expand All @@ -124,6 +125,7 @@ private static void Element_PointerExited(object sender, PointerRoutedEventArgs
}

#if !WINAPPSDK
if (Window.Current?.CoreWindow is not null)
Window.Current.CoreWindow.PointerCursor = cursor;
#endif
}
Expand All @@ -138,6 +140,7 @@ private static void ElementOnUnloaded(object sender, RoutedEventArgs routedEvent
// when the element is programatically unloaded, reset the cursor back to default
// this is necessary when click triggers immediate change in layout and PointerExited is not called
#if !WINAPPSDK
if (Window.Current?.CoreWindow is not null)
Window.Current.CoreWindow.PointerCursor = _defaultCursor;
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions components/Helpers/src/ThemeListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public ThemeListener(DispatcherQueue? dispatcherQueue = null)

DispatcherQueue = dispatcherQueue ?? DispatcherQueue.GetForCurrentThread();

if (Window.Current != null)
if (Window.Current?.CoreWindow is not null)
{
_accessible.HighContrastChanged += Accessible_HighContrastChanged;
_settings.ColorValuesChanged += Settings_ColorValuesChanged;
Expand Down Expand Up @@ -163,7 +163,7 @@ public void Dispose()
{
_accessible.HighContrastChanged -= Accessible_HighContrastChanged;
_settings.ColorValuesChanged -= Settings_ColorValuesChanged;
if (Window.Current != null)
if (Window.Current?.CoreWindow is not null)
{
Window.Current.CoreWindow.Activated -= CoreWindow_Activated;
}
Expand Down