ProgressOverlay doesn't work

Nov 14, 2011 at 11:38 PM

Hi,

I just downloaded a source code, run example. And seams ProgressOverlay doesn't work more. (I mean: I see the text with out any animation.)

I suppose there is a reason in a Mango.

Could you help me?

Coordinator
Nov 15, 2011 at 3:04 AM

There is something with the perf performance bar picker that i saw on the SL Toolkit's page.  I have a custom wrapper I did to pull this off on a different project now.  i couldn't get the isIndeterminate for the perf bar to work with direct binding so I went old school.  I have a user control called "OverlayWrapper" and the internal XAML looks like this:

<c4f:ProgressOverlay Name="overlay"
       Visibility="Collapsed">
  <StackPanel>
   <TextBlock
    HorizontalAlignment="Center"
    Text="{Binding Text}"
    />
   <slToolkit:PerformanceProgressBar Name="progressBar" />
  </StackPanel>
 </c4f:ProgressOverlay>

 

And the source code is:

public partial class OverlayWrapper : UserControl
 {
  public OverlayWrapper()
  {
   InitializeComponent();
   DataContext = this;
  }

  public void Show()
  {
   overlay.Show();
   progressBar.IsIndeterminate = true;
  }

  public void Hide()
  {
   overlay.Hide();
   progressBar.IsIndeterminate = false;
  }

  public string Text
  {
   get { return (string)GetValue(TextProperty); }
   set { SetValue(TextProperty, value); }
  }

  // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
  public static readonly DependencyProperty TextProperty =
   DependencyProperty.Register("Text", typeof(string), typeof(OverlayWrapper), new PropertyMetadata("loading..."));
 }

Coordinator
Dec 8, 2011 at 9:58 AM

looks like the issue was fixed in the november 2011 release of the SL windows phone toolkit

Jan 13, 2012 at 10:39 AM

I have the same problem, just the text shows and no animation.

Using Coding4Fun.Phone.Toolkit v1.5.1 and November 2011 of the Windows Phone Toolkit - Nov 2011 (7.1 SDK)

Downloaded the sample from http://windowsphonegeek.com/articles/WP7-ProgressOverlay-control-in-depth-features-and-customization and this does work, but is using older versions of both Coding4Fun & the Silverlight Toolkit.

Coordinator
Jan 14, 2012 at 5:53 PM
Edited Jan 14, 2012 at 5:55 PM

You need to hook up the isindeterminate property on the performance progress bar.  try the code from the test application in the toolkit.  samples\overlays.xaml

<c4f:ProgressOverlay 
    Name="progressOverlay" 
    Visibility="{Binding OverlayVis}">
    <c4f:ProgressOverlay.Resources>
        <Converters:VisibilityToBooleanConverter x:Key="VisToBoolConverter" />
    </c4f:ProgressOverlay.Resources>
    <StackPanel>
        <TextBlock HorizontalAlignment="Center">Loading</TextBlock>
        <slToolkit:PerformanceProgressBar 
            IsIndeterminate="{Binding ElementName=progressOverlay, 
            Path=Visibility,
            Converter={StaticResource VisToBoolConverter}}"
            />
    </StackPanel>
</c4f:ProgressOverlay>
Coordinator
Jan 14, 2012 at 5:55 PM

on phone:PhoneApplicationPage, you'll need these three namespaces added

xmlns

:slToolkit ="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

 

xmlns:c4f="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls"
 

xmlns:Converters="clr-namespace:Coding4Fun.Phone.Controls.Converters;assembly=Coding4Fun.Phone.Controls"

 

Jan 16, 2012 at 1:20 PM

Cheers, it's now working great.

 

Mike

Mar 12, 2012 at 4:54 AM

I'm having trouble setting this up. I keep getting this error:

 

System.Windows.Data Error: 'MS.Internal.Data.DynamicValueConverter' converter failed to convert value 'False' (type 'System.Boolean'); BindingExpression: Path='OverlayVis' DataItem='SimpleMvvmWindowsPhone2.NewForumsViewModel' (HashCode=78562329); target element is 'Coding4Fun.Phone.Controls.ProgressOverlay' (Name='progressOverlay'); target property is 'Visibility' (type 'System.Windows.Visibility').. System.InvalidOperationException: Can't convert type System.Boolean to type System.Windows.Visibility.

Coordinator
Mar 12, 2012 at 5:53 AM

shism2 you're binding a boolean to a visiblity data type, you'll need toleverage a converter to do that, the toolkit has that.  Look at the posts above yours from me.

Mar 12, 2012 at 2:19 PM

I am using the code you posted above. I then have this in the viewmodel:

  private bool overl;
        public bool OverlayVis
        {
            get
            {
                
                return overl;
            }
         
        }

 

Is this right? I'm new to C# lol.

Coordinator
Mar 13, 2012 at 11:28 PM

@shism2, look at the example above your first post.  You cannot bind a true/false value directly to a property that expects "Visible" or "Collapsed" Visiblity Data Type.

You'll need a converter to do a boolean to visibility translation. 

Check out the documentation as well:  http://coding4fun.codeplex.com/wikipage?title=Converters&referringTitle=Documentation&ANCHOR#booleanToVisibilityConverter