Cannot set Visibility or call Show, ShowDialog, Close, or Hide while
window is closing. in WPF
I am working with wpf-C#, I am facing an issue : that is - on window
closing, visibility is set to hidden and e.Cancel to true. It is working
as expected in Windows 7. But when I tested it with Windows Server 2003
SP2 ,.Net framework 3.5, It is not working as expected.That means, It
hides from the user but when I tried to show on next time it shows the
error- Cannot set Visibility or call Show, ShowDialog, Close, or Hide
while window is closing. It happens only in Windows server 2003. But in
Windows 7 it works fine.
The piece of code is like this:
private void OnClosing( object sender,
System.ComponentModel.CancelEventArgs e )
{
try
{
this.Visibility = Visibility.Hidden;
e.Cancel = true;
this.ShowInTaskbar = false;
}
catch (Exception ex)
{
NeMIASMessageBox.ShowInformationMessageBox(ex.Message);
}
}
No comments:
Post a Comment