"Unexpected call to method or property access." when changing an image's source property.  
Author Message
Michael Kramer





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

I'm trying to change an image's source property in JavaScript. With some images, this line of code:

image["source"] = "newimagepath";

throws this error in JavaScript:

"Unexpected call to method or property access."

Has anyone else seen this error Thanks!



Silverlight (formerly WPF/E)6  
 
 
Mark Rideout





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

That should work. Does it work if you change the line of code to
image.source = "newimagepath";


-mark
Program Manager
Microsoft
This post is provided "as-is"


 
 
Michael Kramer





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

I changed the syntax and it behaves the same way.  I'm open to any other suggestions you may have.

Thanks for you help!

-Michael


 
 
Mark Rideout





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

How do you get your image object Can you show the XAML that the image is defined in

-mark
Program Manager
Microsoft
This post is provided "as-is"


 
 
Michael Kramer





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

The image sits directly in the root canvas object. I'm not starting with a source property -- I'm dynamically adding it through JavaScript in the root canvas's "loaded' event:

<Image Canvas.Top="155" Canvas.Left="10" Width="160" x:Name="Logo2" Opacity="0" />


 
 
Mark Rideout





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

I'll try this out. Does it work if you use different images I've seen one or two bugs on the image not being able to load.

-mark
Program Manager
Microsoft
This post is provided "as-is"


 
 
Michael Kramer





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

It works with most images -- there doesn't seem to be a pattern revolving around the ones that don't.

-Michael Kramer


 
 
Mark Rideout





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

Can you send me one of the images that does not work

-mark
Program Manager
Microsoft
This post is provided "as-is"


 
 
Mark Rideout





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

Michael - Please send me an image that doesn't work when you can.

thanks!
-mark
Program Manager
Microsoft
This post is provided "as-is"


 
 
Henry Stapp





PostPosted: Silverlight (formerly WPF/E) Developer Issues, "Unexpected call to method or property access." when changing an image's source property. Top

Hi Mark,

I'm also encountering this issue. I'm emailing you a sample that demonstrates the problem.

Thanks,

Henry