I believe it is well know my affection for Silverlight and the development experience it provides. The biggest problem with Silverlight in SalesLogix is that whenever you want to host a application you needed to create a custom smartpart and work outside of the box. For some time I have been mentioning to the core dev team at Sage that they should enable a design time experience to allow for easier embedding of a SilverLight control.

So this morning when I got in the office I decided to roll up my sleeves and roll out a host control.

Building the control

1. Create a new .Net Assembly

2. Add References to core SalesLogix assemblies

image

You will find this assemblies in the SalesLogix\Platform folder

3. Create a class that derives from

image

4. Add custom control properties

image

5. Compile and copy the resultant assembly to the Programs\SalesLogix\ folder

6. Register your assembly with the control assembly list

This is nothing more then adding a entry into the QuickFormsConfiguration.xml file. Though I think from an upgrade process or multi-system process this is problematic it does work well. The Help file gives details to the location of the file for different systems. Within my system I navigated to C:\ProgramData\Sage\Platform\Configuration\Application\SalesLogix

7. Create a new Code generation template (velocity)

This was fairly simple to do. I copied an existing template file and renamed to SilverLightHostControl.WebControlRenderingTemplate.vm . Opening the file and deleting the contents to have an empty and ready to copy in the basic Silverlight control rendering code. Once completed adding the code I saved the file. I also copied the file to my control solution so that there was a ready backup provided for me if the system lost the original.

8. Add the control binding into the into the Control list

The final step was to add the control details to the Web.ControlConfiguration.xml file. This file is located in the model and contains the details for the controls that will be available for the smartpart designer.  I added a new WebControlRenderingProvider node. I found it easiest to copy an existing node and replace it with the my control specific details.

image

9. Test

Once all the steps were completed it was time to test the control and ensure that the contents rendered correctly. Starting architect and I located a page to host the Silverlight control. Easily located in the add control menu.

image

image

image

Finally compiling the site and deploying resulted in the following output.

image

 

Final comments

Adding custom controls is an interesting and powerful way of adding new features to your site and can open up functionality that is not quite possible otherwise. The biggest caveat is the number of files that need to be altered to get this to work just right and how that would be managed in a team based project. With the right processes however it can enable some really exciting features.

Leave a Reply