Came across this very nice article by Justin-Josef Angel on the Code Project web site -- Silverlight Controls - The Path to Reusable XAML.

I've been working on a few Silverlight 1.0 projects recently, and a consistent struggle on these has been to maintain data-presentation separation, as well as to adhere to object-oriented principles when dealing with JavaScript and XAML.

This article provides the clearest, most prescriptive guidance I've seen to-date on the use of the JavaScript Prototype pattern to support as "code-behind" for XAML-defined user-interface elements. 

JellyBar - One Object Many Instances

Justin-Angel does a code walk-through that refactors Richard Z's JellyBar sample (which emits XAML dynamically in code with JavaScript) into a "One JavaScript class - One XAML file" model. The result, as the author says, is "it's extensible, it's maintainable, it's object oriented."

Also check out the cool trick with with Visual Studio 2008 JavaScript comments syntax in building the "class constructor" function!

To all who celebrate, Merry Christmas! smile_regular

Technorati Tags: ,