Silverlight
DataContract missing a reference?
Problem playing wav sounds in Silverlight
Error
—————————
A Runtime Error has occurred.
Do you wish to Debug?
Error: Sys.InvalidOperationException: MediaError error #4001 in control ‘Xaml1’: AG_E_NETWORK_ERROR
—————————
Yes No
—————————
Problems using a Blend project after upgrading to Silverlight Beta 2
Machine had Blend pre-beta 2 and had created a SL application.
Along came beta 2 and Blend was un-installed and the latest version of Blend installed.
Old Blend project was manually copied and pasted (see previous post on Blend and Beta 2) into a new Blend project, built and tested.
.xap and default.html copied over to web server.
When default.html was opened the page displayed the Get Silverlight banner even though the browser had the correct Silverlight. Clicking Get displayed a site saying that the site was using an old version of Silverlight.
So I took the source files from Blend and opened them on a machine with Visual Studio + beta 2 toolkit. This told me that the project needed upgrading (eh and why?) so I let it and built the project. Deployed it to the web site and everything worked fine! Not sure what happened there but I’m suspicious of only having Blend on a machine, I’m not ruling out some manual mess-up but why would the Blend build not raise the problem? Oh well, I”ll put it down to beta fun.
Problems upgrading Silverlight Beta 2 project
Implementation of missing combo control/drop down control
A couple of things that don’t (currently) work in Silverlight
Using XAML triggers:
One mechanism that should work in the final version is the ability to create XAML that responds to an even and can trigger something else, such as a storyboard. This is especially useful for Designers who want to test their designs/animations without having to write procedural code. The XAML is "supported" but simply doesn’t work, you get odd messages about values been out of range. This is the idea anyway…
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<BeginStoryboard Storyboard="{StaticResouce mystory}"/>
</EventTrigger>
</Rectangle.Triggers>
However, it’s not all bad news, you can use the above technique if you embed the stroyboard rather than using the static resource. However, this isn’t good for a Designer using Blend as currently blend "loses" the storyboard…you can’t win 😉
Embedding code into XAML:
XAML has a special inline code element, <x:Code> that you place procedural code into it. Ok so you need to write the event handler but that’s pretty close to boiler plate code so easy to copy. Plus you don’t have to leave Blend to write it. However, when I tried it Silverlight just didn’t like it and wouldn’t run the page let alone the code.
Silverlight full screen, now with limited keyboard support
Silverlight Deep Zoom
Silverlight Digg search example
- The tutorial involves a number of swaping one element type for another, the compiler can get easily confused. You can get weird errors that reference the old element when it is nowhere to be found in the source code. It seems that stepping though the initialize code seems to solve this!??
- The data control in the tutorial is called Data:DataGrid, for me it’s my:DataGrid
- Part of the tutorial explains how to separate style from structure, however a number of the controls the tutorial uses don’t support styles as resources. However, if you download the sample code you’ll see that Scott has replaced those with more basic versions, for example the tutorial uses a WatermarkTextBox (doesn’t support resource styles) whereas the sample code uses a straight forward TextBox.
- The tutorial shows the application displaying images, and indeed it does show how to bind to the thumbnail image. However, neither the tutorial or the sample code actually displays images. The problem seems to be that the Linq query is trying to store an entire Xml element into a string, doesn’t work. So you need to change the Linq query from
Thumbnail = (
string)story.Element("thumbnail"), to Thumbnail = (string)story.Element("thumbnail").Attribute("src"), - Binding the Hyperlinkbutton directly to the string href of the story class doesn’t work, it needs to be a URI. So add a URI property to the story…
public Uri HrefUri{get{return new Uri(this.HrefLink);}}