disabling a window

Posted by Arno Greiler on Stack Overflow See other posts from Stack Overflow or by Arno Greiler
Published on 2010-05-20T13:16:06Z Indexed on 2010/05/20 13:20 UTC
Read the original article Hit count: 177

Filed under:
|

In my application I have a button. If the button is clicked as select against a database is executed and the result is shown in a ListView. As the select is quite complex, it takes some time to retrieve the data.

When I click the Button, the Application-Window should be disabled until the data is loaded. But when I set the IsEnabled-Property of the Window to false, the Window gets disabled after the data is loaded.

I tried to disable the Window in an other thread with a BackgroundWorker. But then I get an exception that the Window is alreay in use by an other thread.

How can I disable the Window bevore it retrieves the data?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf