Skip to content

Commit

Permalink
stackpage small feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kikipoulet committed Jan 16, 2025
1 parent 1770851 commit 38cd36c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
6 changes: 5 additions & 1 deletion SukiUI/Controls/SukiStackPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
Margin="0,-20,0,0"
Background="{DynamicResource SukiControlBorderBrush}" />
</StackPanel>
<ContentPresenter Content="{TemplateBinding Content}" />
<TransitioningContentControl Content="{TemplateBinding Content}" >
<TransitioningContentControl.PageTransition>
<CrossFade Duration="0:0:0.4"></CrossFade>
</TransitioningContentControl.PageTransition>
</TransitioningContentControl>
</DockPanel>
</ControlTemplate>
</Setter>
Expand Down
18 changes: 17 additions & 1 deletion SukiUI/Controls/SukiStackPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ public int Limit
get => GetValue(LimitProperty);
set => SetValue(LimitProperty, value);
}

public static readonly StyledProperty<bool> AlwaysGoBackToFirstPageProperty =
AvaloniaProperty.Register<SukiStackPage, bool>(nameof(AlwaysGoBackToFirstPage), defaultValue: false);

public bool AlwaysGoBackToFirstPage
{
get => GetValue(AlwaysGoBackToFirstPageProperty);
set => SetValue(AlwaysGoBackToFirstPageProperty, value);
}


private static readonly DynamicResourceExtension ColorResource = new("SukiLowText");

Expand Down Expand Up @@ -180,7 +190,13 @@ private void AddLowHeader(StackPageModel model)
_disposables.Push(button.Bind(ForegroundProperty, ColorResource));

button.PointerReleased += (_, _) =>
Content = model.Content;
{
if(AlwaysGoBackToFirstPage)
Content = _stackPages[0].Content;
else
Content = model.Content;
};


button.PointerEntered += (_, _) =>
button.RenderTransform = new ScaleTransform() { ScaleX = 1.02, ScaleY = 1.02 };
Expand Down

0 comments on commit 38cd36c

Please sign in to comment.