mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-11-30 02:48:03 +08:00
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:
parent
fc84f806dd
commit
cf9b17f19d
@ -49,7 +49,14 @@ namespace HandyControl.Controls
|
||||
{
|
||||
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()
|
||||
@ -73,4 +80,4 @@ namespace HandyControl.Controls
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user