Background Fade
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Security.Cryptography;
|
||||
@@ -201,10 +202,10 @@ namespace BeWo
|
||||
_CurrentAnimatedBeWoWindow = value;
|
||||
|
||||
if (value is null)
|
||||
HideModalBackground();
|
||||
HideModalBackgroundFade(.5);
|
||||
else
|
||||
{
|
||||
ShowModalBackground();
|
||||
ShowModalBackgroundFade(.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -949,18 +950,26 @@ namespace BeWo
|
||||
}
|
||||
}
|
||||
|
||||
internal void ShowModalBackground()
|
||||
internal void ShowModalBackgroundFade(double duration = 0.3, double opacity = 0.5)
|
||||
{
|
||||
if (ModalPopupBackGround is Grid && grid_main.Children.Contains(ModalPopupBackGround))
|
||||
return;
|
||||
|
||||
ShowModalBackground(0);
|
||||
DoubleAnimation lAnim = new DoubleAnimation(opacity, new Duration(TimeSpan.FromSeconds(duration)));
|
||||
ModalPopupBackGround.BeginAnimation(OpacityProperty, lAnim);
|
||||
}
|
||||
|
||||
internal void ShowModalBackground(double start_opacity = .5)
|
||||
{
|
||||
if (ModalPopupBackGround is Grid && grid_main.Children.Contains(ModalPopupBackGround))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ModalPopupBackGround = new Grid
|
||||
{
|
||||
IsHitTestVisible = true,
|
||||
Background = Brushes.White,
|
||||
Opacity = .5
|
||||
Opacity = start_opacity
|
||||
};
|
||||
|
||||
Grid.SetColumnSpan(ModalPopupBackGround, 3);
|
||||
@@ -971,12 +980,23 @@ namespace BeWo
|
||||
Panel.SetZIndex(ModalPopupBackGround, 500);
|
||||
}
|
||||
|
||||
internal void HideModalBackgroundFade(double duration = 0.3)
|
||||
{
|
||||
if (ModalPopupBackGround is null || !grid_main.Children.Contains(ModalPopupBackGround))
|
||||
return;
|
||||
|
||||
DoubleAnimation lAnim = new DoubleAnimation(0, new Duration(TimeSpan.FromSeconds(duration)));
|
||||
lAnim.Completed += (s, e) =>
|
||||
{
|
||||
HideModalBackground();
|
||||
};
|
||||
ModalPopupBackGround.BeginAnimation(OpacityProperty, lAnim);
|
||||
}
|
||||
|
||||
internal void HideModalBackground()
|
||||
{
|
||||
if (ModalPopupBackGround is null || !grid_main.Children.Contains(ModalPopupBackGround))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
grid_main.Children.Remove(ModalPopupBackGround);
|
||||
ModalPopupBackGround = null;
|
||||
|
||||
@@ -64,11 +64,6 @@ namespace BeWo.View.Windows
|
||||
rootGroupBox.Content = fe;
|
||||
}
|
||||
|
||||
public AnimatedBeWoWindow(FrameworkElement fe, string stylestring) : this(fe)
|
||||
{
|
||||
rootGroupBox.Style = (Style)FindResource(stylestring);
|
||||
}
|
||||
|
||||
public void Window_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (!closeStoryBoardCompleted && !isClosing)
|
||||
|
||||
Reference in New Issue
Block a user