Add project files.

This commit is contained in:
Daniel Clark
2022-11-01 15:26:08 +00:00
parent daa7b59f22
commit 7e4f880821
408 changed files with 16863 additions and 0 deletions
@@ -0,0 +1,359 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
namespace TheXamlGuy.UI.WPF.Controls;
public class TransitioningContentControl : ContentControl
{
public static readonly DependencyProperty TransitionDirectionProperty =
DependencyProperty.RegisterAttached(nameof(TransitioningContentControlTransitionDirection),
typeof(TransitioningContentControlTransitionDirection), typeof(TransitioningContentControl), new PropertyMetadata(TransitioningContentControlTransitionDirection.Left));
public static readonly DependencyProperty TransitionDurationProperty =
DependencyProperty.RegisterAttached(nameof(Duration),
typeof(TimeSpan), typeof(TransitioningContentControl), new PropertyMetadata(TimeSpan.FromSeconds(0.3)));
public static readonly DependencyProperty TransitionProperty =
DependencyProperty.RegisterAttached(nameof(Transition),
typeof(TransitioningContentControlTransitionType), typeof(TransitioningContentControl), new PropertyMetadata(TransitioningContentControlTransitionType.Fade));
private Storyboard? completingTransition;
private Grid? container;
private ContentPresenter? currentContentPresentationSite;
private bool isTransitioning;
private VisualStateGroup? presentationGroup;
private Image? previousImageSite;
private Storyboard? startingTransition;
public TransitioningContentControl()
{
DefaultStyleKey = typeof(TransitioningContentControl);
}
public event RoutedEventHandler? TransitionCompleted;
public event RoutedEventHandler? TransitionStarted;
public TransitioningContentControlTransitionDirection Direction
{
get => (TransitioningContentControlTransitionDirection)GetValue(TransitionDirectionProperty);
set => SetValue(TransitionDirectionProperty, value);
}
public TimeSpan Duration
{
get => (TimeSpan)GetValue(TransitionDurationProperty);
set => SetValue(TransitionDurationProperty, value);
}
public TransitioningContentControlTransitionType Transition
{
get => (TransitioningContentControlTransitionType)GetValue(TransitionProperty);
set => SetValue(TransitionProperty, value);
}
private Storyboard? CompletingTransition
{
get => completingTransition;
set
{
if (completingTransition is not null)
{
CompletingTransition!.Completed -= OnTransitionCompleted;
}
completingTransition = value;
if (completingTransition is not null)
{
CompletingTransition!.Completed += OnTransitionCompleted;
SetTransitionDefaultValues();
}
}
}
private Storyboard? StartingTransition
{
get => startingTransition;
set
{
startingTransition = value;
if (startingTransition is not null)
{
SetTransitionDefaultValues();
}
}
}
public override void OnApplyTemplate()
{
container = GetTemplateChild("Container") as Grid;
if (container is not null)
{
presentationGroup = ((IEnumerable<VisualStateGroup>)VisualStateManager.GetVisualStateGroups(container))!.FirstOrDefault(x => x.Name == "PresentationStates");
}
currentContentPresentationSite = GetTemplateChild("CurrentContentPresentationSite") as ContentPresenter;
previousImageSite = GetTemplateChild("PreviousImageSite") as Image;
if (currentContentPresentationSite is not null)
{
currentContentPresentationSite.Content = Content;
}
VisualStateManager.GoToState(this, "Normal", false);
}
protected override void OnContentChanged(object oldContent, object newContent)
{
QueueTransition(newContent);
base.OnContentChanged(oldContent, newContent);
}
private static RenderTargetBitmap GetRenderTargetBitmapFromUiElement(UIElement uiElement)
{
if (uiElement.RenderSize.Height == 0 || uiElement.RenderSize.Width == 0)
{
return default!;
}
DpiScale dpiScale = VisualTreeHelper.GetDpi(uiElement);
double pixelWidth = Math.Max(1.0, uiElement.RenderSize.Width * dpiScale.DpiScaleX);
double pixelHeight = Math.Max(1.0, uiElement.RenderSize.Height * dpiScale.DpiScaleY);
RenderTargetBitmap renderTargetBitmap = new(Convert.ToInt32(pixelWidth), Convert.ToInt32(pixelHeight), dpiScale.PixelsPerInchX, dpiScale.PixelsPerInchY, PixelFormats.Pbgra32);
renderTargetBitmap.Render(uiElement);
renderTargetBitmap.Freeze();
return renderTargetBitmap;
}
private void AbortTransition()
{
VisualStateManager.GoToState(this, "Normal", false);
isTransitioning = false;
if (previousImageSite is not null)
{
if (previousImageSite.Source is RenderTargetBitmap renderTargetBitmap)
{
renderTargetBitmap.Clear();
}
previousImageSite.Source = null;
previousImageSite.UpdateLayout();
}
}
private Storyboard GetTransitionStoryboardByName(string transitionName)
{
if (presentationGroup is not null)
{
if (((IEnumerable<VisualState>)presentationGroup.States).Where(x => x.Name == transitionName).Select(x => x.Storyboard).FirstOrDefault() is Storyboard transition)
{
return transition;
}
}
return new Storyboard();
}
private void OnTransitionCompleted(object? sender, EventArgs args)
{
AbortTransition();
TransitionCompleted?.Invoke(this, new RoutedEventArgs());
}
private void QueueTransition(object newContent)
{
if (currentContentPresentationSite is null)
{
return;
}
if (isTransitioning || previousImageSite is null)
{
currentContentPresentationSite.Content = newContent;
return;
}
previousImageSite.Source = GetRenderTargetBitmapFromUiElement(currentContentPresentationSite);
currentContentPresentationSite.Content = newContent;
string transitionInName = string.Empty;
int statesRemaining = 0;
string startingTransitionName = string.Empty;
if (Transition == TransitioningContentControlTransitionType.Bounce)
{
transitionInName = $"{Transition}{Direction}In";
CompletingTransition = GetTransitionStoryboardByName(transitionInName);
startingTransitionName = $"{Transition}{Direction}Out";
StartingTransition = (Storyboard?)GetTransitionStoryboardByName(startingTransitionName);
statesRemaining = 2;
StartingTransition!.Completed += NextState;
}
else
{
if (StartingTransition is not null)
{
StartingTransition!.Completed -= NextState;
}
StartingTransition = null;
startingTransitionName = Transition == TransitioningContentControlTransitionType.Fade ? "Fade" : $"{Transition}{Direction}";
CompletingTransition = GetTransitionStoryboardByName(startingTransitionName);
statesRemaining = 1;
}
isTransitioning = true;
RaiseTransitionStarted();
statesRemaining--;
VisualStateManager.GoToState(this, startingTransitionName, false);
void NextState(object? sender, EventArgs args)
{
StartingTransition!.Completed -= NextState;
if (statesRemaining == 1)
{
statesRemaining--;
VisualStateManager.GoToState(this, transitionInName, false);
}
}
}
private void RaiseTransitionStarted()
{
TransitionStarted?.Invoke(this, new RoutedEventArgs());
}
private void SetTransitionDefaultValues()
{
switch (Transition)
{
case TransitioningContentControlTransitionType.Fade:
{
if (CompletingTransition is null)
{
return;
}
DoubleAnimation completingDoubleAnimation = (DoubleAnimation)CompletingTransition.Children[0];
completingDoubleAnimation.Duration = Duration;
DoubleAnimation startingDoubleAnimation = (DoubleAnimation)CompletingTransition.Children[1];
startingDoubleAnimation.Duration = Duration;
break;
}
case TransitioningContentControlTransitionType.Slide:
{
if (CompletingTransition is null)
{
return;
}
DoubleAnimation startingDoubleAnimation = (DoubleAnimation)CompletingTransition.Children[0];
startingDoubleAnimation.Duration = Duration;
startingDoubleAnimation.From = Direction switch
{
TransitioningContentControlTransitionDirection.Down => -ActualHeight,
TransitioningContentControlTransitionDirection.Up => ActualHeight,
TransitioningContentControlTransitionDirection.Right => -ActualWidth,
TransitioningContentControlTransitionDirection.Left => ActualWidth,
_ => throw new ArgumentOutOfRangeException(nameof(TransitioningContentControlTransitionDirection))
};
break;
}
case TransitioningContentControlTransitionType.Move:
{
if (CompletingTransition is null)
{
return;
}
DoubleAnimation completingDoubleAnimation = (DoubleAnimation)CompletingTransition.Children[0];
DoubleAnimation startingDoubleAnimation = (DoubleAnimation)CompletingTransition.Children[1];
startingDoubleAnimation.Duration = Duration;
completingDoubleAnimation.Duration = Duration;
switch (Direction)
{
case TransitioningContentControlTransitionDirection.Down:
startingDoubleAnimation.To = ActualHeight;
completingDoubleAnimation.From = -ActualHeight;
break;
case TransitioningContentControlTransitionDirection.Up:
startingDoubleAnimation.To = -ActualHeight;
completingDoubleAnimation.From = ActualHeight;
break;
case TransitioningContentControlTransitionDirection.Right:
startingDoubleAnimation.To = ActualWidth;
completingDoubleAnimation.From = -ActualWidth;
break;
case TransitioningContentControlTransitionDirection.Left:
startingDoubleAnimation.To = -ActualWidth;
completingDoubleAnimation.From = ActualWidth;
break;
default: throw new ArgumentOutOfRangeException(nameof(TransitioningContentControlTransitionDirection));
}
break;
}
case TransitioningContentControlTransitionType.Bounce:
{
if (CompletingTransition is not null)
{
DoubleAnimationUsingKeyFrames completingDoubleAnimation = (DoubleAnimationUsingKeyFrames)CompletingTransition.Children[0];
completingDoubleAnimation.KeyFrames[1].Value = ActualHeight;
}
if (StartingTransition is null)
{
return;
}
DoubleAnimation startingDoubleAnimation = (DoubleAnimation)StartingTransition.Children[0];
startingDoubleAnimation.To = Direction switch
{
TransitioningContentControlTransitionDirection.Down => ActualHeight,
TransitioningContentControlTransitionDirection.Up => -ActualHeight,
TransitioningContentControlTransitionDirection.Right => ActualWidth,
TransitioningContentControlTransitionDirection.Left => -ActualWidth,
_ => throw new ArgumentOutOfRangeException(nameof(TransitioningContentControlTransitionDirection))
};
break;
}
case TransitioningContentControlTransitionType.Drop: break;
default: throw new ArgumentOutOfRangeException(nameof(TransitioningContentControlTransitionDirection));
}
}
}
@@ -0,0 +1,496 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:TheXamlGuy.UI.WPF.Controls">
<Style TargetType="controls:TransitioningContentControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:TransitioningContentControl">
<Grid
x:Name="Container"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Image
x:Name="PreviousImageSite"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Source="{x:Null}">
<Image.RenderTransform>
<TransformGroup>
<TransformGroup.Children>
<ScaleTransform ScaleX="1" ScaleY="1" />
<TranslateTransform X="0" Y="0" />
</TransformGroup.Children>
</TransformGroup>
</Image.RenderTransform>
</Image>
<ContentPresenter
x:Name="CurrentContentPresentationSite"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{x:Null}"
ContentTemplate="{TemplateBinding ContentTemplate}">
<ContentPresenter.RenderTransform>
<TransformGroup>
<TransformGroup.Children>
<ScaleTransform ScaleX="1" ScaleY="1" />
<TranslateTransform X="0" Y="0" />
</TransformGroup.Children>
</TransformGroup>
</ContentPresenter.RenderTransform>
</ContentPresenter>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="PresentationStates">
<VisualState x:Name="Normal">
<Storyboard>
<ObjectAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Fade">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="1"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="0"
To="1"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="SlideLeft">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="-30"
To="0"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="SlideRight">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="-30"
To="0"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="SlideDown">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="-30"
To="0"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="SlideUp">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="-30"
To="0"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="MoveLeft">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="-30"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="0"
To="30"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="MoveRight">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="-30"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="0"
To="30"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="MoveDown">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="-30"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="0"
To="30"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="MoveUp">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="-30"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="0"
To="30"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="DropDown">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="-30"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="0"
To="30"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="0"
To="1"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="1"
To="0"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="DropUp">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="0"
To="30"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="-30"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="0"
To="1"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="1"
To="0"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="DropRight">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="-30"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="0"
To="30"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="0"
To="1"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="1"
To="0"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="DropLeft">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="-30"
To="0"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="0"
To="30"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="CurrentContentPresentationSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="0"
To="1"
Duration="00:00:00.3" />
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.Opacity)"
From="1"
To="0"
Duration="00:00:00.3" />
</Storyboard>
</VisualState>
<VisualState x:Name="BounceLeftIn">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90" />
<EasingDoubleKeyFrame KeyTime="00:00:00.4" Value="-90" />
<EasingDoubleKeyFrame KeyTime="00:00:00.7" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<CircleEase EasingMode="EaseOut" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.Opacity)">
<DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" />
<DiscreteDoubleKeyFrame KeyTime="00:00:00.4" Value="1" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousImageSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="BounceLeftOut">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="0"
To="-90"
Duration="00:00:00.2" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="BounceRightIn">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90" />
<EasingDoubleKeyFrame KeyTime="00:00:00.4" Value="-90" />
<EasingDoubleKeyFrame KeyTime="00:00:00.7" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<CircleEase EasingMode="EaseOut" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.Opacity)">
<DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" />
<DiscreteDoubleKeyFrame KeyTime="00:00:00.4" Value="1" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousImageSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="BounceRightOut">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)"
From="0"
To="-90"
Duration="00:00:00.2" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="BounceUpIn">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90" />
<EasingDoubleKeyFrame KeyTime="00:00:00.4" Value="-90" />
<EasingDoubleKeyFrame KeyTime="00:00:00.7" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<CircleEase EasingMode="EaseOut" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.Opacity)">
<DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" />
<DiscreteDoubleKeyFrame KeyTime="00:00:00.4" Value="1" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousImageSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="BounceUpOut">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="0"
To="-90"
Duration="00:00:00.2" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="BounceDownIn">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90" />
<EasingDoubleKeyFrame KeyTime="00:00:00.4" Value="-90" />
<EasingDoubleKeyFrame KeyTime="00:00:00.7" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<CircleEase EasingMode="EaseOut" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.Opacity)">
<DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" />
<DiscreteDoubleKeyFrame KeyTime="00:00:00.4" Value="1" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousImageSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="BounceDownOut">
<Storyboard>
<DoubleAnimation
BeginTime="00:00:00"
Storyboard.TargetName="PreviousImageSite"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)"
From="0"
To="-90"
Duration="00:00:00.2" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -0,0 +1,9 @@
namespace TheXamlGuy.UI.WPF.Controls;
public enum TransitioningContentControlTransitionDirection
{
Up,
Down,
Left,
Right
}
@@ -0,0 +1,10 @@
namespace TheXamlGuy.UI.WPF.Controls;
public enum TransitioningContentControlTransitionType
{
Fade,
Move,
Slide,
Drop,
Bounce
}