Reputation: 550
I'm developing a Silverlight 4 RIA application. There is a DataGrid
storing data and two buttons: add a new item and remove an item. After creating a new item for the second time the application freezes like this - I'll explain the strange behaviour below.
The scenario of creating a new item looks like this:
The child window causes the entire application to freeze only when it's called twice, but the first call requires object creation. I can open and close the child window repeatedly and everything will work fine until a sequence of: open.create -> open.close / open.create occurs. I tried to trace all exceptions with VS tool (alt ctrl e) but there are none.
A breakpoint on
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
does not show anything either. Any ideas?
Upvotes: 2
Views: 1069
Reputation: 550
I did a bit more research after you helped me with this issue. Seems its a SL4 bug. This should also help. Topic about this on SL forums.
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
Application.Current.RootVisual.SetValue(Control.IsEnabledProperty, true);
}
Upvotes: 0
Reputation: 3356
Remove the following and everything will be fine.
private void ChildWindow_Closed(object sender, EventArgs e)
{
this.DialogResult = false;
}
And to evaluate a bit more, ChildWindow_Closed is the outcome of setting the DialogResult at the first place. By re setting it unexpected things happen.
Upvotes: 1