Lately I’ve ran into situations where I had to change elements or had to request a value in the DOM from Silverlight. jLight, which was introduced in an earlier article, can help with that. jQuery offers great ways to change CSS during runtime. Silverlight can access the DOM, but it isn’t as easy as jQuery.
To accomplish this little trick I need to define a wrapper DIV in my CSS. This Div will then wrap the entire contents of the site, so now I only have to center that DIV. We need to define the width of the content area: it makes sense that you want to set the size of something you want to center so it can be calculated. To do this, I set the width property of the wrapper DIV to the pixel width of my Silverlight control.
Damian Edwards stayed at my house a week leading up to MIX09 and he’s had an amazing impact on our product teams whilst he stayed. One question he did provoke my way was what makes Silverlight better than JavaScript/HTML (forgot the actual wording but the meaning i walked away with was just that).