How to make a sliding panel animation on Avalonia>?
Hi, im working on a avalonia project , but its similar to wpf
i have a login panel, (username password etc) but id like to add a sliding animation to that to make it look more professional, how would i do this?
54 Replies
Mind showing your code?
the (A)XAML that is
ok so thats the simpe login page xaml with a login button @Buddy, Citizen of Pluto š±
and this is the second apge with just images
what i want is when the second page is shown, to have a little animation
like it sliding from the right
What are you making?
the app that is
š
just a simple photo app to hold my ingame screenshots
Cool
since i kidna lose it all in the default photo apps
i just want a page sliding animation
it seems so simple yet so hard
Please, do not use Margin as your layout
i use grid
Margin is the spacing between elements
ohhh
ok
Please prefer layouting controls
such as Grid, DockPanel, StackPanel, etc.
And do not have margin higher than 50
alright
either way, back to your issue.
do you know how to make a sliding animation
when the second page shows up
Oh, my apologies. I thought you were using Avalonia
i am
Wait, you are.
that is avalonia
this is how they say to do it on their documents
Please change title to Avalonia, the styling API is not the same
but i really dont get it
it doesnt work for me
Mind sharing code of what you have so far regarding PageSlide?
Right, and it will animate when content of ContentControl is changed
where can i insert this
i dont think ive made a content control
https://docs.avaloniaui.net/docs/reference/controls/transitioningcontentcontrol
But first, your xaml structure is invalid
You need to set it like that
like this?
oh edited
You were right with this, except you were setting the content and not the PageTransition
your example its binded to an image
i want it so the new window slides in
not a specific image
Yes, you bind it to whatever you want
from your ViewModel
as Content is an object, so it can contain anything
it doesnt recognise the mainwindow
You must use a binding
i know binding works for iamges but for windows?
Or by setting the content from code-behind, but I do not recommend it
ive never done that for entire windows idk how
You can't bind a window as Content, but you can however bind to a usercontrol
all of this just for 1 page to slide in>?
It's how their API is set up.
can you guide me on where to go
so these are my 2 windows
If a person plans incorrectly it could go like this.
i want the dashboard window to be the one sliding in from ther ight
so i would bind the dashboard or the mainwindow to the useercontrol?
does Dashboard derive from Window?
their both avalonia windows
thats just their names
Okay, unfortunately you cannot do that.
it has to be a usercontrol
You can simply just create a new usercontrol
it will be the same except you won't have the window itself but the content; can still be done with xaml