I am working on a project right now that has to separate project files. One complies in Silverlight 3 and the other in Silverlight 4. The project creates a user control that is used in a couple other projects. Unfortunately one is in SL3 and cant be upgraded right now which is why a SL3 version of the control is needed.
So far it has worked out fine but recently I tried to add a ViewBox to the control. This causes a problem because in SL3 it is located in the toolbox and in SL4 it is in the core.
Is there any way to have it pull from the toolkit in the SL3 project and the core in the SL4 project? I looked into preprocessor definitions in xaml and found some info but I don’t like how it kills the ability to load the code in the designer.
What I ended up doing is creating a border around the inner viewbox elements. Then I got rid of the viewbox in xaml. When I load the control I set the child of the containing border to null, create a viewbox in code, and set its child to the inner border. Then I set the child of the containing border to the viewbox.
Code Behind