views:

504

answers:

3

Sometimes when i open a particular context menu on a button and then press another button the whole window goes black except for a rectangle. When i minimize and maximize or move the window to another screen the window repaints. I am registered to the button and context menu's events and it include some work like changing bounded properties and so forth. Is it my fault, (and if it is, how can i fix it?) or it's a framework bug?

Update (23.07): I avoided the problem in that specific area, but i still don't know much about it. I had a ListBox with a ContextMenu on top of it. The ListBox'es visibility was bounded to a certain property, when it had one value the ListBox was Visible and when it had another value it was Collapsed. The ContextMenu's MenuItem Changed the property that in turn changed the visibility. Sometimes when the visibility was changed to Collapsed the whole screen turned black. After playing around with it I noticed that it doesn't happen in Hidden so now i use Hidden instead of Collapsed. I guess rearranging the controls after collapsing one in the middle was the problem.

+1  A: 

It sounds like the UI thread is being held up while processing is taking place. Same thing happens when you are debugging a WPF app and you hit a break point, or you have an usually long data query etc before you return the results to the screen.

To get around this I push the majority of my processing into a separate thread to ensure that the UI is never effected by other processing.

TravisPUK
When I'm debugging the window freezes or goes white, it never goes black. There's almost no real processing, all i do is change a bounded property. Do you think the binding takes that long?
SHD_lotion
There is no other explanation, really. You said that the property is the source of a lot of binding- it's reasonable to think that your UI isn't updating while all of these bindings are taking place.Without some specific code, it will be very hard to determine what could cause this problem, outside of the most general case (which is that the UI is blocked somehow).
Charlie
SHD_lotion, it initially goes white for me also unless I jump back to it, it then shows in black. As for how long your binding takes, not sure, just that it is more likely to be the reason for the black screen rather than a bug.
TravisPUK
You could test it by spitting your binding into a new thread and see if your screen still goes black.
TravisPUK
A: 

First of all, I realized that the screen goes black only when I have some kind of pop-up open (ContextMenu, ComboBox) and while it's open I change the visibility of something else.


Apparently it's because I (and the rest of my team) use 2 computer screens with the ATI Radeon X1300 Pro driver. If you disable the second screen everything's ok. Thanks anyway...

SHD_lotion
A: 

I am also getting this problem. We have Nvidia 9400 series graphics cards, but our users have multiple monitors. Any ideas on a specific fix?

Kelly
nope.. but maybe it was fixed in .net 4.0.try downloading the new beta and check it out.
SHD_lotion
Checked it. It was not.
SHD_lotion