From 8b144a90de740ed4c17ed7586fb82bc5b062d5e1 Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Thu, 14 Nov 2019 00:01:57 +0800
Subject: [PATCH] completed the branch
---
README.md | 25 +-
.../HandyControlDemo_Core30.csproj | 3 +
.../HandyControlDemo_Net_40.csproj | 3 +
.../HandyControlDemo_Net_GE45.csproj | 3 +
.../Data/MessageToken.cs | 4 +-
.../Data/MessageToken.tt | 3 +-
.../HandyControlDemo_Shared.projitems | 7 +
.../Properties/Langs/Lang.Designer.cs | 9 +
.../Properties/Langs/Lang.en.resx | 3 +
.../Properties/Langs/Lang.fa.resx | 3 +
.../Properties/Langs/Lang.fr.resx | 3 +
.../Properties/Langs/Lang.resx | 3 +
.../TransitioningContentControl_16x.png | Bin 0 -> 352 bytes
.../Resources/Themes/Styles/Style.xaml | 24 ++
.../Controls/TabControlDemoCtl.xaml | 31 +-
.../TransitioningContentControlDemoCtl.xaml | 53 +++
...TransitioningContentControlDemoCtl.xaml.cs | 10 +
.../UserControl/Main/LeftMainContent.xaml | 5 +
.../Other/TransitioningContentControl.cs | 303 +++---------------
.../Data/Enum/TransitionMode.cs | 16 +
.../HandyControl_Shared.projitems | 1 +
.../Styles/TransitioningContentControl.xaml | 173 +++++-----
22 files changed, 321 insertions(+), 364 deletions(-)
create mode 100644 src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/TransitioningContentControl_16x.png
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml.cs
create mode 100644 src/Shared/HandyControl_Shared/Data/Enum/TransitionMode.cs
diff --git a/README.md b/README.md
index cc9002de..57ceeefe 100644
--- a/README.md
+++ b/README.md
@@ -17,14 +17,31 @@
[https://handyorg.github.io/handycontrol/](https://handyorg.github.io/handycontrol/)
-### 捐赠
-如果您觉得HandyControl还不错,并且刚好有些闲钱,那么可以选择以下两种方式来捐赠:
+### 赞助
+如果您觉得HandyControl还不错,并且刚好有些闲钱,那么可以选择以下两种方式来赞助:
* [以HandyControl的名义为慈善事业做贡献](http://www.chinacharityfederation.org/ConfirmDonation/0.html?zhijie=3)
* 为我们购买防脱洗发水
![qrcode](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/qrcode.png)
+## Contributors
+
+
+
+
+
+
+
+
+
+## Backers
+
+
+
+
+
+
## Special thanks to
[![JetBrains](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/resharper_logo.png)](https://www.jetbrains.com/?from=HandyControl)
@@ -383,6 +400,10 @@ Step 4:enjoy coding
![CirclePanel](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/CirclePanel.jpg)
+### TransitioningContentControl
+
+![TransitioningContentControl](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/TransitioningContentControl.gif)
+
### BorderStyle
![BorderStyle](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/Border.png)
diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
index 055fd6d1..66eac0be 100644
--- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
+++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
@@ -439,6 +439,9 @@
Resources\Img\LeftMainContent\PopupCursor_16x.png
+
+ Resources\Img\LeftMainContent\TransitioningContentControl_16x.png
+
diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
index 91e7c38f..44e96af7 100644
--- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
+++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
@@ -430,6 +430,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\TransitioningContentControl_16x.png
+
Resources\Img\LeftMainContent\PopupCursor_16x.png
diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
index b3b7a445..5cf76e7a 100644
--- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
@@ -496,6 +496,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\TransitioningContentControl_16x.png
+
Resources\Img\LeftMainContent\PopupCursor_16x.png
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
index 8c984761..31a98a9a 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
@@ -99,7 +99,7 @@
public static readonly string GridDemoCtl = nameof(GridDemoCtl);
public static readonly string PoptipDemoCtl = nameof(PoptipDemoCtl);
-
+
public static readonly string RangeSliderDemoCtl = nameof(RangeSliderDemoCtl);
public static readonly string ButtonGroupDemoCtl = nameof(ButtonGroupDemoCtl);
@@ -124,6 +124,8 @@
public static readonly string DividerDemoCtl = nameof(DividerDemoCtl);
+ public static readonly string TransitioningContentControlDemoCtl = nameof(TransitioningContentControlDemoCtl);
+
/*-------------------- Tools --------------------*/
public static readonly string HatchBrushGeneratorDemoCtl = nameof(HatchBrushGeneratorDemoCtl);
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
index 6d152292..10c881f8 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
@@ -63,7 +63,8 @@ var controlList = new List
"NotificationDemoCtl",
"FloatingBlockDemoCtl",
"SplitButtonDemoCtl",
- "DividerDemoCtl"
+ "DividerDemoCtl",
+ "TransitioningContentControlDemoCtl"
};
var styleList = new List
{
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index 09b4abbc..35d3356f 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -218,6 +218,9 @@
TransferDemoCtl.xaml
+
+ TransitioningContentControlDemoCtl.xaml
+
WaterfallPanelDemoCtl.xaml
@@ -683,6 +686,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
index 397ce9ed..94bfcf21 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -1680,6 +1680,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 内容过渡控件 的本地化字符串。
+ ///
+ public static string TransitioningContentControl {
+ get {
+ return ResourceManager.GetString("TransitioningContentControl", resourceCulture);
+ }
+ }
+
///
/// 查找类似 树视图 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
index fd7c626c..4ddc96ae 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -684,4 +684,7 @@
top-start;top;top-end;right-start;right;right-end;bottom-end;bottom;bottom-start;left-end;left;left-start
+
+ TransitioningContentControl
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
index f68af839..b65b9415 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
@@ -684,4 +684,7 @@
top-start;top;top-end;right-start;right;right-end;bottom-end;bottom;bottom-start;left-end;left;left-start
+
+ TransitioningContentControl
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
index c01f2d99..2fe1a113 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
@@ -684,4 +684,7 @@
top-start;top;top-end;right-start;right;right-end;bottom-end;bottom;bottom-start;left-end;left;left-start
+
+ TransitioningContentControl
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
index 0de5fbbe..2bd0b2f2 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -684,4 +684,7 @@
上左;上边;上右;右上;右边;右下;下右;下边;下左;左下;左边;左上
+
+ 内容过渡控件
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/TransitioningContentControl_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/TransitioningContentControl_16x.png
new file mode 100644
index 0000000000000000000000000000000000000000..c047c5fa1a29a598eaf0133cf80e72b111dce53e
GIT binary patch
literal 352
zcmV-m0iXVfP)pG5=lfsRCr#Uk}YzDKoEp;gd8PDNO6(~Jkh8qJf12f2f*V|G5Ci=
zAXe}v$$nckTazI#l{~73g=M>^yN4%xt?T--@4NGL+OlWwf{UU!lO)mgHv$EInBb(U
zs(OrI+qSyvx(G_s^nV1)vfKp3I?rqGHRA^QCkFT0w
z7zThrg}3%0XZpVXPGDyZuq?~4wrxwGLO@3E7X{q(2Hx{LKbxjuPY7zj(=<7q5gA+*
zXo*yoW#oaCph#x~sSZy(1GFV!iYlHzBUl&yEs$=kq6V;Y?%9q`
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml
index a59e9b15..490a8b1c 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml
@@ -17,13 +17,38 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml
new file mode 100644
index 00000000..b7d76fec
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml.cs
new file mode 100644
index 00000000..92a140ce
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TransitioningContentControlDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class TransitioningContentControlDemoCtl
+ {
+ public TransitioningContentControlDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
index a0d2b13a..3fd46ca8 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
@@ -375,6 +375,11 @@
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/TransitioningContentControl.cs b/src/Shared/HandyControl_Shared/Controls/Other/TransitioningContentControl.cs
index fe84b94a..07f7dea9 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/TransitioningContentControl.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Other/TransitioningContentControl.cs
@@ -1,285 +1,76 @@
-using System;
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
-using System.Windows.Markup;
+using System.Windows.Media;
using System.Windows.Media.Animation;
using HandyControl.Data;
using HandyControl.Tools;
namespace HandyControl.Controls
{
- [TemplateVisualState(GroupName = PresentationGroup, Name = NormalState)]
- [TemplateVisualState(GroupName = PresentationGroup, Name = DefaultTransitionState)]
- [TemplatePart(Name = PreviousContentPresentationSitePartName, Type = typeof(ContentControl))]
- [TemplatePart(Name = CurrentContentPresentationSitePartName, Type = typeof(ContentControl))]
- [ContentProperty("Content")]
- public class TransitioningContentControl : Control
+ public class TransitioningContentControl : ContentControl
{
- private Storyboard _currentTransition;
+ private FrameworkElement _contentPresenter;
public TransitioningContentControl()
{
- if (!DesignerProperties.GetIsInDesignMode(this))
- {
- DefaultStyleKey = typeof(TransitioningContentControl);
- }
+ Loaded += TransitioningContentControl_Loaded;
+ IsVisibleChanged += TransitioningContentControl_IsVisibleChanged;
}
- private Storyboard CurrentTransition
+ public static readonly DependencyProperty TransitionModeProperty = DependencyProperty.Register(
+ "TransitionMode", typeof(TransitionMode), typeof(TransitioningContentControl), new PropertyMetadata(default(TransitionMode), OnTransitionModeChanged));
+
+ private static void OnTransitionModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- set
- {
- if (_currentTransition != null)
- _currentTransition.Completed -= OnTransitionCompleted;
-
- _currentTransition = value;
-
- if (_currentTransition != null)
- _currentTransition.Completed += OnTransitionCompleted;
- }
+ var ctl = (TransitioningContentControl) d;
+ ctl.StartTransition();
}
- #region Events
+ public TransitionMode TransitionMode
+ {
+ get => (TransitionMode) GetValue(TransitionModeProperty);
+ set => SetValue(TransitionModeProperty, value);
+ }
- public event RoutedEventHandler TransitionCompleted;
+ public static readonly DependencyProperty TransitionStoryboardProperty = DependencyProperty.Register(
+ "TransitionStoryboard", typeof(Storyboard), typeof(TransitioningContentControl), new PropertyMetadata(default(Storyboard)));
- #endregion Events
+ public Storyboard TransitionStoryboard
+ {
+ get => (Storyboard) GetValue(TransitionStoryboardProperty);
+ set => SetValue(TransitionStoryboardProperty, value);
+ }
+
+ private void TransitioningContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) => StartTransition();
+
+ private void TransitioningContentControl_Loaded(object sender, RoutedEventArgs e) => StartTransition();
+
+ private void StartTransition()
+ {
+ if (Visibility != Visibility.Visible || _contentPresenter == null) return;
+
+ (TransitionStoryboard ?? ResourceHelper.GetResource($"{TransitionMode.ToString()}Transition"))?.Begin(_contentPresenter);
+ }
public override void OnApplyTemplate()
{
- if (DesignerProperties.GetIsInDesignMode(this)) return;
-
- if (IsTransitioning)
- AbortTransition();
-
base.OnApplyTemplate();
- PreviousContentPresentationSite =
- GetTemplateChild(PreviousContentPresentationSitePartName) as ContentPresenter;
- CurrentContentPresentationSite =
- GetTemplateChild(CurrentContentPresentationSitePartName) as ContentPresenter;
-
- if (CurrentContentPresentationSite != null)
- CurrentContentPresentationSite.Content = Content;
-
- var transition = GetStoryboard(Transition);
- CurrentTransition = transition;
- if (transition == null)
+ _contentPresenter = VisualTreeHelper.GetChild(this, 0) as FrameworkElement;
+ if (_contentPresenter != null)
{
- Transition = DefaultTransitionState;
-
- throw new ArgumentException("TransitioningContentControl_TransitionNotFound");
- }
-
- VisualStateManager.GoToState(this, NormalState, false);
- VisualStateManager.GoToState(this, Transition, true);
- }
-
- public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
- "Content", typeof(object), typeof(TransitioningContentControl), new PropertyMetadata(default(object), OnContentChanged));
-
- private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var ctl = (TransitioningContentControl) d;
- ctl.StartTransition(e.OldValue, e.NewValue);
- }
-
- public static readonly DependencyProperty ContentTemplateProperty = DependencyProperty.Register(
- "ContentTemplate", typeof(DataTemplate), typeof(TransitioningContentControl), new PropertyMetadata(default(DataTemplate)));
-
- public DataTemplate ContentTemplate
- {
- get => (DataTemplate) GetValue(ContentTemplateProperty);
- set => SetValue(ContentTemplateProperty, value);
- }
-
- public object Content
- {
- get => GetValue(ContentProperty);
- set => SetValue(ContentProperty, value);
- }
-
- [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "newContent", Justification = "Should be used in the future.")]
- private void StartTransition(object oldContent, object newContent)
- {
- if (CurrentContentPresentationSite != null && PreviousContentPresentationSite != null)
- {
- CurrentContentPresentationSite.Content = newContent;
-
- PreviousContentPresentationSite.Content = oldContent;
-
- if (!IsTransitioning || RestartTransitionOnContentChange)
+ _contentPresenter.RenderTransformOrigin = new Point(0.5, 0.5);
+ _contentPresenter.RenderTransform = new TransformGroup
{
- IsTransitioning = true;
- VisualStateManager.GoToState(this, NormalState, false);
- VisualStateManager.GoToState(this, Transition, true);
- }
+ Children =
+ {
+ new ScaleTransform(),
+ new SkewTransform(),
+ new RotateTransform(),
+ new TranslateTransform()
+ }
+ };
}
}
-
- private void OnTransitionCompleted(object sender, EventArgs e)
- {
- AbortTransition();
-
- var handler = TransitionCompleted;
- handler?.Invoke(this, new RoutedEventArgs());
- }
-
- public void AbortTransition()
- {
- VisualStateManager.GoToState(this, NormalState, false);
- IsTransitioning = false;
- if (PreviousContentPresentationSite != null)
- PreviousContentPresentationSite.Content = null;
- }
-
- private Storyboard GetStoryboard(string newTransition)
- {
- var presentationGroup = VisualHelper.TryGetVisualStateGroup(this, PresentationGroup);
- Storyboard newStoryboard = null;
- if (presentationGroup != null)
- newStoryboard = presentationGroup.States
- .OfType()
- .Where(state => state.Name == newTransition)
- .Select(state => state.Storyboard)
- .FirstOrDefault();
- return newStoryboard;
- }
-
- #region Visual state names
-
- private const string PresentationGroup = "PresentationStates";
-
- private const string NormalState = "Normal";
-
- public const string DefaultTransitionState = "DefaultTransition";
-
- #endregion Visual state names
-
- #region Template part names
-
- internal const string PreviousContentPresentationSitePartName = "PreviousContentPresentationSite";
-
- internal const string CurrentContentPresentationSitePartName = "CurrentContentPresentationSite";
-
- #endregion Template part names
-
- #region TemplateParts
-
- private ContentPresenter CurrentContentPresentationSite { get; set; }
-
- private ContentPresenter PreviousContentPresentationSite { get; set; }
-
- #endregion TemplateParts
-
- #region public bool IsTransitioning
-
- private bool _allowIsTransitioningWrite;
-
- public bool IsTransitioning
- {
- get => (bool)GetValue(IsTransitioningProperty);
- private set
- {
- _allowIsTransitioningWrite = true;
- SetValue(IsTransitioningProperty, value);
- _allowIsTransitioningWrite = false;
- }
- }
-
- public static readonly DependencyProperty IsTransitioningProperty =
- DependencyProperty.Register(
- "IsTransitioning",
- typeof(bool),
- typeof(TransitioningContentControl),
- new PropertyMetadata(OnIsTransitioningPropertyChanged));
-
- private static void OnIsTransitioningPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var source = (TransitioningContentControl)d;
-
- if (!source._allowIsTransitioningWrite)
- {
- source.IsTransitioning = (bool)e.OldValue;
- throw new InvalidOperationException("TransitiotioningContentControl_IsTransitioningReadOnly");
- }
- }
-
- #endregion public bool IsTransitioning
-
- #region public string Transition
-
- public string Transition
- {
- get => GetValue(TransitionProperty) as string;
- set => SetValue(TransitionProperty, value);
- }
-
- public static readonly DependencyProperty TransitionProperty =
- DependencyProperty.Register(
- "Transition",
- typeof(string),
- typeof(TransitioningContentControl),
- new PropertyMetadata(DefaultTransitionState, OnTransitionPropertyChanged));
-
- private static void OnTransitionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var source = (TransitioningContentControl)d;
- var oldTransition = e.OldValue as string;
- var newTransition = e.NewValue as string;
-
- if (source.IsTransitioning)
- source.AbortTransition();
-
- var newStoryboard = source.GetStoryboard(newTransition);
-
- if (newStoryboard == null)
- if (VisualHelper.TryGetVisualStateGroup(source, PresentationGroup) == null)
- {
- source.CurrentTransition = null;
- }
- else
- {
- source.SetValue(TransitionProperty, oldTransition);
-
- throw new ArgumentException(
- "TransitioningContentControl_TransitionNotFound");
- }
- else
- source.CurrentTransition = newStoryboard;
- }
-
- #endregion public string Transition
-
- #region public bool RestartTransitionOnContentChange
-
- public bool RestartTransitionOnContentChange
- {
- get => (bool)GetValue(RestartTransitionOnContentChangeProperty);
- set => SetValue(RestartTransitionOnContentChangeProperty, value);
- }
-
- public static readonly DependencyProperty RestartTransitionOnContentChangeProperty =
- DependencyProperty.Register(
- "RestartTransitionOnContentChange",
- typeof(bool),
- typeof(TransitioningContentControl),
- new PropertyMetadata(ValueBoxes.FalseBox, OnRestartTransitionOnContentChangePropertyChanged));
-
- private static void OnRestartTransitionOnContentChangePropertyChanged(DependencyObject d,
- DependencyPropertyChangedEventArgs e)
- {
- ((TransitioningContentControl)d).OnRestartTransitionOnContentChangeChanged((bool)e.OldValue,
- (bool)e.NewValue);
- }
-
- protected virtual void OnRestartTransitionOnContentChangeChanged(bool oldValue, bool newValue)
- {
- }
-
- #endregion public bool RestartTransitionOnContentChange
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Data/Enum/TransitionMode.cs b/src/Shared/HandyControl_Shared/Data/Enum/TransitionMode.cs
new file mode 100644
index 00000000..35b33fdf
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Data/Enum/TransitionMode.cs
@@ -0,0 +1,16 @@
+namespace HandyControl.Data
+{
+ public enum TransitionMode
+ {
+ Right2Left,
+ Left2Right,
+ Bottom2Top,
+ Top2Bottom,
+ Right2LeftWithFade,
+ Left2RightWithFade,
+ Bottom2TopWithFade,
+ Top2BottomWithFade,
+ Fade,
+ Custom
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index 077f6b78..9c8cb1eb 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -41,6 +41,7 @@
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml
index 0e238931..8d7d7d4a 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/TransitioningContentControl.xaml
@@ -1,105 +1,76 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file