|
|
|
@ -13,20 +13,20 @@ namespace Avalonia.ReactiveUI |
|
|
|
/// <summary>
|
|
|
|
/// <see cref="AvaloniaProperty"/> for the <see cref="PageTransition"/> property.
|
|
|
|
/// </summary>
|
|
|
|
public static readonly StyledProperty<IPageTransition> PageTransitionProperty = |
|
|
|
AvaloniaProperty.Register<TransitioningContentControl, IPageTransition>(nameof(PageTransition), |
|
|
|
public static readonly StyledProperty<IPageTransition?> PageTransitionProperty = |
|
|
|
AvaloniaProperty.Register<TransitioningContentControl, IPageTransition?>(nameof(PageTransition), |
|
|
|
new CrossFade(TimeSpan.FromSeconds(0.5))); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <see cref="AvaloniaProperty"/> for the <see cref="DefaultContent"/> property.
|
|
|
|
/// </summary>
|
|
|
|
public static readonly StyledProperty<object> DefaultContentProperty = |
|
|
|
AvaloniaProperty.Register<TransitioningContentControl, object>(nameof(DefaultContent)); |
|
|
|
public static readonly StyledProperty<object?> DefaultContentProperty = |
|
|
|
AvaloniaProperty.Register<TransitioningContentControl, object?>(nameof(DefaultContent)); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the animation played when content appears and disappears.
|
|
|
|
/// </summary>
|
|
|
|
public IPageTransition PageTransition |
|
|
|
public IPageTransition? PageTransition |
|
|
|
{ |
|
|
|
get => GetValue(PageTransitionProperty); |
|
|
|
set => SetValue(PageTransitionProperty, value); |
|
|
|
@ -35,7 +35,7 @@ namespace Avalonia.ReactiveUI |
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the content displayed whenever there is no page currently routed.
|
|
|
|
/// </summary>
|
|
|
|
public object DefaultContent |
|
|
|
public object? DefaultContent |
|
|
|
{ |
|
|
|
get => GetValue(DefaultContentProperty); |
|
|
|
set => SetValue(DefaultContentProperty, value); |
|
|
|
@ -44,7 +44,7 @@ namespace Avalonia.ReactiveUI |
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the content with animation.
|
|
|
|
/// </summary>
|
|
|
|
public new object Content |
|
|
|
public new object? Content |
|
|
|
{ |
|
|
|
get => base.Content; |
|
|
|
set => UpdateContentWithTransition(value); |
|
|
|
@ -60,7 +60,7 @@ namespace Avalonia.ReactiveUI |
|
|
|
/// Updates the content with transitions.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="content">New content to set.</param>
|
|
|
|
private async void UpdateContentWithTransition(object content) |
|
|
|
private async void UpdateContentWithTransition(object? content) |
|
|
|
{ |
|
|
|
if (PageTransition != null) |
|
|
|
await PageTransition.Start(this, null, true); |
|
|
|
|