HOW TO DO? View refresh in WPF form?!?!

D

Dmitry Bond.

Hi.

I need quite a simple thing - when user changed selection in ComboBox
I need to put semi-transparent RECTANGLE over the whole form with the
"Connecting service..." text. Thus, user see that something in pogress
and form controls are unavailable.

The first idea I got was - put Rectangle + Label on a form, mark them
as Visibility=Hidden, then in "cmbServer_SelectionChanged" event
handler execute code like this:

rectProgress.Visibility = Visibility.Visible;
labProgressText.Content = string.Format("Trying server {0}
({1}) ...", pSrvName, url);
try
{
// ... operation takes about 3 - 10 seconds ...
}
finally
{
rectProgress.Visibility = Visibility.Hidden;
}

But it does not work - Rectangle does not appears at all.
Could you please advice - what is wrong and what can I do to make it
working?

Regards,
Dmitry.
 
A

Alun Harford

Dmitry said:
Hi.

I need quite a simple thing - when user changed selection in ComboBox
I need to put semi-transparent RECTANGLE over the whole form with the
"Connecting service..." text. Thus, user see that something in pogress
and form controls are unavailable.

The first idea I got was - put Rectangle + Label on a form, mark them
as Visibility=Hidden, then in "cmbServer_SelectionChanged" event
handler execute code like this:

rectProgress.Visibility = Visibility.Visible;
labProgressText.Content = string.Format("Trying server {0}
({1}) ...", pSrvName, url);
try
{
// ... operation takes about 3 - 10 seconds ...
}
finally
{
rectProgress.Visibility = Visibility.Hidden;
}

But it does not work - Rectangle does not appears at all.
Could you please advice - what is wrong and what can I do to make it
working?

You're doing a long-running synchronous operation in the UI thread.

See: http://msdn.microsoft.com/en-us/library/ms741870.aspx

for more information

Alun Harford
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top