简体   繁体   中英

How to show window from bottom to top in wpf in animation

static int screenWidth = (int)SystemParameters.WorkArea.Width;
static int screenHeight = (int)SystemParameters.WorkArea.Height;

int heightAvail = ((screenHeight - intHeight) / 2);
int widthAvail = ((screenWidth - intWidth) / 2);
DoubleAnimation animation = new DoubleAnimation(widthAvail, widthAvail, TimeSpan.FromMilliseconds(300));
DoubleAnimation animationT = new DoubleAnimation(1920, heightAvail, TimeSpan.FromMilliseconds(300));
objUIElement.BeginAnimation(Window.LeftProperty, animation);
objUIElement.BeginAnimation(Window.TopProperty, animationT);

This is one I'm using for doing Animation But its coming to center. I want it should stick to bottom of window.

How to achieve this? Please share some ideas.

Why are you dividing the heightAvail with 2 ??

int heightAvail = (screenHeight - intHeight);

This should do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM