Update TransitioningContentControl.cs
Fix. Null Exception. When using "ContextMenu" with "TransitioningContentControl" and when "MenuItem" call "Application Shutdown", then the application throws a null exception, because "Application.Current" is null and fadeout animation call "ResourceHelper.GetResource".
This commit is contained in:
1 parent
fc84f806dd
commit
cf9b17f19d
1 file changed
+9
-2
@@ -49,7 +49,14 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
if (Visibility != Visibility.Visible || _contentPresenter == null) return;
|
if (Visibility != Visibility.Visible || _contentPresenter == null) return;
|
||||||
|
|
||||||
(TransitionStoryboard ?? ResourceHelper.GetResource<Storyboard>($"{TransitionMode.ToString()}Transition"))?.Begin(_contentPresenter);
|
if (TransitionStoryboard != null)
|
||||||
|
{
|
||||||
|
TransitionStoryboard.Begin(_contentPresenter);
|
||||||
|
}
|
||||||
|
else if (Application.Current != null)
|
||||||
|
{
|
||||||
|
ResourceHelper.GetResource<Storyboard>($"{TransitionMode.ToString()}Transition")?.Begin(_contentPresenter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnApplyTemplate()
|
public override void OnApplyTemplate()
|
||||||
@@ -73,4 +80,4 @@ namespace HandyControl.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user