diff --git a/components/Animations/src/Extensions/CompositorExtensions.cs b/components/Animations/src/Extensions/CompositorExtensions.cs index 5358ab80..b9944195 100644 --- a/components/Animations/src/Extensions/CompositorExtensions.cs +++ b/components/Animations/src/Extensions/CompositorExtensions.cs @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/components/Extensions/src/Element/FrameworkElementExtensions.Mouse.cs b/components/Extensions/src/Element/FrameworkElementExtensions.Mouse.cs index d1bced06..a1d74a59 100644 --- a/components/Extensions/src/Element/FrameworkElementExtensions.Mouse.cs +++ b/components/Extensions/src/Element/FrameworkElementExtensions.Mouse.cs @@ -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 } @@ -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 } @@ -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 } diff --git a/components/Helpers/src/ThemeListener.cs b/components/Helpers/src/ThemeListener.cs index 29b2c289..af35e3d9 100644 --- a/components/Helpers/src/ThemeListener.cs +++ b/components/Helpers/src/ThemeListener.cs @@ -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; @@ -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; } diff --git a/tooling b/tooling index ce05388f..e366657a 160000 --- a/tooling +++ b/tooling @@ -1 +1 @@ -Subproject commit ce05388f0ad2f241612a28a0e03cb58c80515e65 +Subproject commit e366657a924a745c6fb4162dc4c58d2e07fc0613