Question

I am trying to compile AvalonEdit for Silverlight, but I am not sure how to do it as I never worked with Silverlight, only WPF.

I tried to add this control to my Silverlight application but Visual Studio complained that the assembly wasn't compiled against Silverlight.

I thought it was gonna be a matter of picking Silverlight under the target platform in the project settings.

Any ideas?

Was it helpful?

Solution

You need to create new project which targets silverlight (File - New Project - Silverlight) and then add all the source code from the AvalonEdit source code into that library.

Edit:

Also note that the control might use classes that are not available in Silverlight. From the codeplex discussion related to this control (from year 2009):

Silverlight does not have the System.Windows.Media.TextFormatting namespace, so you'd have to rewrite a large part of the ICSharpCode.AvalonEdit.Rendering namespace if you want to port AvalonEdit to Silverlight.

OTHER TIPS

Silverlight and WPF assemblies are not compatible. So any assembly you reference from your Silverlight assembly must also have been compiled as a Silverlight assembly. I'm assuming your reference to "project settings" is your assembly, not the third party assembly.

But, compiling WPF code as Silverlight may be challenging. Silverlight is a functional subset of WPF so the code may use features not available in Silverlight.

In silverlight projects you can't reference non-silverlight dll's or projects. So in this project if there is an essential non-silverlight dll for building this project. You cant do this build.

If there are just some usages wfp supports but silverlight doesnt support find out this differs. Then exclude these codes or use pragma

#if !WPF
//Todo
#endif
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top