Search code examples
c#wpfanimationmarshallingmainwindow

The pointless question. It can be deleted


Here is the link to the original post: Animating a WPF window width and height. Thanks for the given example. The code works great. But only on the main window. If i create a child window. ChildWnd cw = new ChildWnd(); cw.Owner = this; cw.Show(); I paste all the code identically into this window. The animation does not work. No errors and no animation either. Please help fix this problem. I'm not good at marshaling. But it is very important for my project.


Solution

  • Oh, thanks, I already understood. It is necessary to replace the third parameter, in two places, with the class name of the child window. DependencyProperty WindowHeightAnimationProperty and WindowWidthAnimationProperty:

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