开发者

WPF Window Top Won't Change

开发者 https://www.devze.com 2023-01-02 04:57 出处:网络
I am using animations with my window to slide out or slide back up. But when these animations are not used开发者_运维百科.

I am using animations with my window to slide out or slide back up. But when these animations are not used开发者_运维百科. I would like to use Window.Top to set the position of the window, but I think due to animations I cannot set the top. I was wondering if anyone knows how to fix this? Thanks

example.

window.top is already = 33. but when is ay window.top =900; it will stay at 33.


Manual value changes are ignored while an animation is running. You need to remove the animation from the property entirely to make the manually-set values visible.

If you started your animation with a BeginStoryboard action, use a RemoveStoryboard action to remove it:

<RemoveStoryboard BeginStoryboardName="NameOfStoryboard" />

If you applied your animation in code or otherwise, the trick is to pass "null" into the BeginAnimation method to remove it:

window.BeginAnimation(Window.TopProperty, null);


In many cases you can call a Storyboard's Remove method to reset the value source from an animation back to the original source, in this case your explicit value. If you could post some code it would be easier to get a more definitive answer.


Try setting FillBehavior="Stop" in your animation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号