Reserved XAP file names (‘..Resource.dll’)

My Silverlight app was referencing an external assembly, called Library.Resources.dll, which contained some images. When I set my UriSource to UriSource="/Library.Common;Component/Images/view.png" my image appeared at design time without any problem. However, when I ran the application the image would not appear.

After inspecting the contents of my XAP file I noticed that the resource assembly was missing. Apparently, assembly’s ending in Resource.dll are not allowed in the XAP which was why mine was missing. I changed the name of the assembly to Library.Common, as well as my UriSource then the assembly was included in the XAP file and and my images successfully appeared.

The remote server returned an error: NotFound

Always start with the obvious…if you are using Silverlight make sure you have a basicHttpBinding endpoint specified for the WCF service. Otherwise, the request will not even make it to the server because the relevant endpoint is ‘NotFound‘.

Silverlight ListBox and the ItemContainerStyle

Stretching out the Listbox content.
 
In order to get the content of my Listbox ItemTemplate to fill out the entire width of the Listbox control, I simply needed to add an ItemContainerStyle as follows:
 

<UserControl.Resources>

    <Style x:Key="ListBoxItemStyle1" TargetType="ListBoxItem">

        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>

        <Setter Property="HorizontalAlignment" Value="Stretch"/>

    </Style>

</UserControl.Resources>

 
The solution came from here…

Silverlight 3 DataTriggers

Using DataTriggers to control Storyboard actions.
 
More details are available here…

External and Local Resources in App.xaml

The property ‘Resource’ is set more than once.
 
Working on my Silverlight application that contained local and external resources I was getting the error (above) in the App.xaml file. The error was displayed even thought the build was successful and my application ran. I found the solution to my problem here.

Silverlight & WCF projects in different solutions

Getting my WCF Service to talk to my Silverlight app in Visual Studio
 
I have been developing a Silverlight application to get data from a pre-existing WCF Service. The code for the service was already in production and was available in its own Visual Studio solution. In order to debug my Silverlight application, which was running from within a different solution, I needed to add a crossdomain.xml file to the root of the folder where the service was running from. This is necessary even though both solutions were using the ASP.Net Development Server (localhost) on different ports. A full explaination is available on MSDN for Making a Service Available Across Domain Boundaries. Tim Heuer also has a very good explaination of the problem and solution here.

Using different Endpoints in a WCF Service

Avoiding confusion when referencing a Service?
 
Whilst playing with a WCF Service for my Silverlight application I encountered the following error:
 
An endpoint configuration section for contract could not be loaded because more than one endpoint configuration for that contract was found
 
It seems that becuase my client config file contained multiple configuration endpoints, I needed to specify which endpoint to access during the service initialisation. Tim Heuer has a very good blog post on Managing service references and endpoint configurations for Silverlight applications which helped me to figure out this problem.