I've tried many things to du that, but none are working. Let me explain:
this is how my app works: I click on buttons, it call methods with http requests. The request are all synchronous.
button click -> set loading visual to Visible -> http request in the same method -> http request finished-> set loading visual to Collapsed.
This is the code example :
public static StackPanel loading ;
public static void setLoading()
{
MyStaticValues.loading.Visibility = Visibility.Visible;
MyStaticValues.loading.UpdateLayout();
}
public static void setUnLoading()
{
MyStaticValues.loading.Visibility = Visibility.Collapsed;
MyStaticValues.loading.UpdateLayout();
}
...
MyStaticValues.loading = this.spinner;
MyStaticValues.loading.InvalidateVisual();
...
...
// http request method -on click-
MyStaticValues.setLoading();
..do HTTP request..
// after success ->
MyStaticValues.setUnLoading();
..end..
It always go into the setLoading/ setUnLoading methods, but the UI is never refresh.
As i Said, The request are all synchronous.
The problem is probably from this, But I would like to keep the request on synchronous if possible..
any idea?