首页 > 解决方案 > 毫无意义的问题。可以删除

问题描述

这是原始帖子的链接:为 WPF 窗口宽度和高度设置动画。感谢您提供的示例。代码效果很好。但仅限于主窗口。如果我创建一个子窗口。ChildWnd cw = new ChildWnd(); cw.Owner = 这个;cw.Show(); 我将所有代码相同地粘贴到此窗口中。动画不起作用。没有错误,也没有动画。请帮助解决这个问题。我不擅长编组。但这对我的项目非常重要。

标签: c#wpfanimationmarshallingmainwindow

解决方案


哦,谢谢,我已经明白了。需要将第三个参数在两个地方替换为子窗口的类名。DependencyProperty WindowHeightAnimationProperty 和 WindowWidthAnimationProperty:

public static readonly DependencyProperty WindowHeightAnimationProperty = DependencyProperty.Register("WindowHeightAnimation", typeof(double), typeof(ChildWnd), new PropertyMetadata(OnWindowHeightAnimationChanged));


推荐阅读