Window Hiding and Showing issues (February CTP)

Hi everyone,

I've been witnessing some strange behaviour regarding WPF Windows and I wanted to know if anyone else has been seeing the same thing.

I have derived from the System.Windows.Window class and have provided a custom handler to the Closing event. The custom handler simply hides the window using Window.Hide(). Now, on the window I show it, close it, show it again, close it again, and after that sequence it won't show. So it won't display more than twice after becoming hidden twice.

I've also tried overriding the OnClosing method.

Does anyone have any ideas

Thanks,
Steve


Answer this question

Window Hiding and Showing issues (February CTP)

  • Keith Koh

    I met the similar question.

    I put 3 buttons on a canvas. The buttons is simply used to control a mediaelement to begin, pause and resume. If I puase and resume for several times, I lose the control. The movie can not be resumed any more.

    Very strange.



  • chaospixel

    Steve,

    It sounds like this could be a bug. Could you share the code for your Closing event handler

    Thanks,
    Lauren [MS]



  • MarketFare

    Lauren,

    Thanks for the reply. The problem I had was solved by setting a Cancel property to 'true', here it is for future reference

    private void HandleClosing(object sender, System.ComponentModel.CancelEventArgs e)
    {
    this.Hide();
    e.Cancel = true;
    }

    this is hooked up to the Window's Closing event.

    Steve



  • Window Hiding and Showing issues (February CTP)