You are introducing a variable “
p
” in the local scope of the whole function :s
not really.. you know you can use brackets anywhere inside the code to define subscopes, don't you:
{
var p = this.StatusProgressBar;
p.IsIndeterminate = false;
p.Visibility = Visibility.Visible;
p.Minimum = 0;
p.Maximum = 100;
p.Value = percentage;
}