11. November 2008
ZeroKoll
Silverlight
The problem I wrote about earlier talking about the JavaScript bridge failing when the plug-in is in a div that has it's display set to hidden, is still in Silverlight 2 RTW. But I figured out why. When the plug-in is in a hidden div, the bridge doesn't work, and showing the div from JavaScript and calling the plug-in directly after isn't working either. I tried doing the following, without success:
[code:js]
var hostDiv = document.getElementById("silverlightControlHost");
var plugin = hostDiv.childNodes(0);
hostDiv.className = "hostDivVisible";
plugin.content.ScriptableObjectRef.CallMethod();
[/code]
More...
I know this has a simple fix, but the error message might not be too clear to some people. If you try to use Linq to XML you must first start off by adding a using statement for System.Linq.Xml. This is very easy to do... Just write the initial XDocument, with the right casing, and then press "Ctrl+." and then enter. This will add the using statement and you can keep going. So you start writing your query but it doesn't work.
More...
I just found an interesting thing... I just created my first Deep Zoom application. I know...I'm way behind most people, but I stick to something and learn it well before moving on. That's just the way I am. Well, back to topic. I added my images to the Composer and set them up as I wanted them and then exported my project. I choose to include a Silverlight app with the export. When I tried watching it in my browser, I got a message saying that I needed to get Silverlight.
More...
Once in a while you do get the possiblity to do something that is gonna be seen by the developer community more than others things you do. This week I got to create my first screencast for Microsoft Sweden. It turned into a WAY too long screencast covering basic development in Silverlight 2.0. Beside being shown and talked about on a couple of different blogs on the web, I also had the privilege of getting mentioned in the Swedish MSDN newsletter. So as I said...a pure brag entry telling the world that I got to do something cool. Unfortunately for all the enlish speaking people out there, the newsletter as well as my screencast is in swedish. But for the rest of you here are a couple of places where you can see or read about it:
http://blogs.msdn.com/robf/archive/2008/10/14/introduktion-till-utveckling-med-silverlight-2.aspx
http://www.microsoft.com/sverige/msdn/mail/2008/msdnNyhetsbrev_081016.html
http://labs.episerver.com/en/Blogs/Per/Archive/2008/10/Sample-Silverlight-2--Dynamic-Content/
Somebody actually cares...maybe...might be that i know both Robert and Per and that they are just being nice to me...but I don't give a damn...I...Chris Klug was mentioned on the world wide web by other people than my family...
I ran in to an interesting little feature in Silverlight 2b2 the other day. I was trying out a little idea I had. What would happen if I placed a Silverlight application with a width and height of 100% inside a DIV and then tried resizing the DIV using the HTML DOM bridge...? Well, I created a simple Silverlight application, which was basically a big button, and in the Click event I used the JavaScript bridge to resize the DIV dynamically. Worked like a charm. The DIV resized and the application followed along, just like I wanted. Until I started tweaking...
More...
I got another question about an issue in Silverlight 2.0 Beta 2. My collegue who is at the moment working on a video-player came to me and asked me why MouseLeftButtonDown- and Up didn't work on the slider and after 2 minutes of Googling we found out that he wasn't the only one faced with this problem. I started by Googling a bit more. Google is a developers best friend, but I couldn't find a solution. I found the reason for the problem, which I confirmed by checking the sliders code in Reflector. It is actually not a change in Silverlight as such, but in the controls that ship with Silverlight. For some reason Microsoft changed the implementation of their controls from Beta 1 to 2 and started letting each individual template part handle their on mouse events.So each part of the control encapsulates itsfunctionality nicely and sets the Handled-property of the EventArgs to true in their eventhandlers. This causes the event to stop bubbling and also renders the MouseLeftButtonDown, Up and so on the control more or less useless.
More...
A couple of weeks ago I had a look at a "module" for EPiServer CMS 5. It's going to be a part of our new package called Create+, and is called InteractiveScene. It basically gives the editor the ability to add and configure Flash-based content using EPiServer.
So, how does this end up being an entry on my blog? Well, it got me thinking. But first off I have is to say that I'm not here to replace InteractiveScene in any way. Neither am I here to tell you to do it. My concept builds on top of InteractiveScene, using it, not replacing it. It would of course be possible to use my thoughts to use this outside of EPiServer, in which case you would have to build the parts that I use from InteractiveScene manually.
So, back to the question, why am I blogging about a third party application for EPiServer? And why the @#!*% am I blogging about something that is using Flash? Everybody knows what I think about Flash... I love it, but don't know how to use it. The whole idea about how to use Flash is built around people who have minds that don't work in the same way as mine. So...thats actually the answer to the question. The "education" I got in "IS" was mostly based around the editors interface. All the cool development is actually made in Flash and just configured through EPiServer and thats no good for me. So I do of course have to find a way to tweak the system to use Silverlight instead of Flash.
More...
A feature that is often missed in Silvelright is the possibility to give the application information at start up. Sort of like sending parameters to a constructor. This is done by passing values through the InitParams property. This feature has been available since Silverlight 1.0, but it has changed in 2.0. A 2.0 application is split in two parts, an Application class and a UserControl, and the InitParams is sent to the Application part. If you listen to the Application.Startup event, you will get hold of an StartupEventArgs object. This control contains a InitParams property containing the values sent to the control. The InitParams is a comma separated string when added in markup, but a IDictionary<string,string> when in code. How you pass it from the Application object to the UserControl is up to the developer. There are several ways of doing this. The simplest is to add a parameter to the contructor of the UserControl and pass in the Dictionary there. Another is to add a property on the Application class and "publish" the information there and let the UserControl fetch it.
This parameter is available to us if we use the <asp:Silverlight /> control. This makes it a very simple way for us to pass a certain amount of data from serverside aspx code to our clientside Silverlight application without having to use Ajax or webservices. Or maybe we could use the InitParams to tell our application the Uri to the webservice...