如何显示窗口从下到上在wpf动画

本文关键字:从下到上 wpf 动画 窗口 何显示 显示 | 更新日期: 2023-09-27 18:09:39

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);

这个是我用来做动画的但是它在中心。我想让它贴在窗口的底部。

如何实现这一点?

如何显示窗口从下到上在wpf动画

你为什么把heightAvail和2分开??

int heightAvail = (screenHeight - intHeight);