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

  • Thread starter Thread starter Dmitry Bond.
  • Start date Start date
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.
 
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
 
Back
Top