Issues with DownloadProgressChanged
Last post 05-06-2008 1:30 AM by slhacker. 2 replies.
Sort Posts:
05-05-2008 2:12 AM
Issues with DownloadProgressChanged

When messing with SL 1.0 I notice that sometimes images that report to load fine (fire event with DownloadProgress = 1), the image still comes back with zero dimensions.

My workaround is firing a javascript timeout that keeps checking for the w/h to be set.

Has anyone had an issue with this? This workaround is a hack and looks awkward (my elements position a split second after everything is initially loaded). See what I mean here: http://www.pollmenow.com (click to enable game mode which uses SL).

Am I missing some step or is this a known issue?

slhacker

Joined on 05-05-2008
Posts 4
05-05-2008 4:10 PM
Re: Issues with DownloadProgressChanged

can you post some code because I get the following error loading your page:

silverlight error message
errorcode: 2024
errortype: parseerror
message: invalid attribute value WrapWith Overflow for property TextWrapping.
XamlFile: xaml.php?=1257
line:25
position:73

 

Greg
www.GJHDigital.com

GJHDigital

Joined on 12-26-2005
Posts 203
05-06-2008 1:30 AM
Re: Issues with DownloadProgressChanged

Odd, from searching it seems SL2 beta doesn't support (yet?) WrapWithOverflow text wrapping. I've been only working with SL1 so I didn't run into that error. Sorry about that.

At any rate, here's my (relevant) xaml:

<Image MouseEnter="imgIn" MouseLeave="imgOut" DownloadProgressChanged="imgProgChanged" Opacity="1" x:Name="img1" Canvas.Left="50" Canvas.Top="25" Source="http://www.pollmenow.com/assets/pimgs/39454354860.jpg" />

Here's the javascript handler: 

function imgProgChanged(sender, args)
{
 if(sender.DownloadProgress == 1)
  alert("DownloadProgress was 1 and img height was " + sender.Height); // reports 0 Height on first view. Hitting F5 to refresh always reports height correctly
}

Here is the workaround that always works correctly but results in an odd delay from when the content is first shown until it's positioned correctly. It seems that even a 100ms delay gets the property set:

var img = null;

function imgProgChanged(sender, args)
{
   if(sender.DownloadProgress == 1)
   {
     img = sender;
     setTimeout("reportBack();",100);
    }

}

function reportBack()
{
 alert(img.Height); // always report height correctly
}

Thanks for the help 

GJHDigital:

can you post some code because I get the following error loading your page:

silverlight error message
errorcode: 2024
errortype: parseerror
message: invalid attribute value WrapWith Overflow for property TextWrapping.
XamlFile: xaml.php?=1257
line:25
position:73

 

slhacker

Joined on 05-05-2008
Posts 4