Silverlight Trick: Inline Silverlight Apps

About 6 months ago I wrote a little piece about how to create simple animations. It would seem that the thing people liked best about that post was not the animation itself but the way in which I included it inline with text. So here’s a little post on how to create that effect.

Creating this look is incredibly easy. While working on another post here at  Ascentium I built this sample, so now I’ll share it with you. I almost feel silly even explaining this in a post as it’s so simple, but hey, I’ll go for it anyway.

This example is just a hyperlink to Ascentium but has a couple of animations that are beyond what you can accomplish with HTML/CSS.

Silverlight App

Your Silverlight application itself is created just like you would any other and can be as simple or complex as you want. The key thing to remember is that the app needs to be as small as possible. I’ve found that about 12 pixels works great for the height and whatever width fits your purpose.

UserControl

Embedding it inline

This part is also pretty easy if you know HTML at all. All you need to do is to include the object tag within the text that is being displayed. As you can see from the following sample, the height and width are also defined on the object itself.

InlineHtml

Considerations

There are a few things to be aware of when adding Silverlight inline like this, some of which are demonstrated above.

First, no Silverlight. Be sure to include a “downlevel” experience for viewers that do not have Silverlight installed. This can be the standard “Download Silverlight” button if you like but be careful as it will probably not fit in the space allotted. What I chose to do in this case was to just show a text link to the same destination, this way the user has a consistent performance although with a less fancy link.

Second, whitespace. Some browsers, like Internet Explorer, will not honor whitespace before or after the object. The fix for this is simple, and you can see it above as well. What I did was just use a non-breaking space before and after the object. Another solution would be to build the padding into your application itself.

Next, background colors. I built this sample with a white background but sometimes that may not suit your needs. If you need a transparent background you need to set the background to be transparent in both the Silverlight app and in the object params. Further, you also need to set windowlessmode to true in the object params. This can have a negative effect if you are running video but otherwise would be fine.

Also, text scaling. By using this technique to display text inline with HTML, you lose the browsers ability to scale the text for the user. You may be able to create a workaround for this limitation but I’m not going into that at the moment.

Finally, text & link. This sample has the text (Ascentium) and the link destination (www.ascentium.com) both hard-coded into the application. It would also be possible to load one or both of those from initialization parameters set on the object. This would allow you to have a Silverlight app that has a cool effect on it and use it in multiple places.s

#1 Silverlight Girl on 12.04.2008 at 2:57 PM

Terrific use for a Silverlight App! I can't wait to put it into practice. Thank you very much for the thorough explanation.

#2 Silverlight Travel on 12.08.2008 at 1:59 AM

Such a small think. ;-) But such a great idea

#3 ricky on 5.12.2009 at 10:56 PM

Interesting post, this was really useful. thanks!

#4 lissa on 5.25.2009 at 9:55 PM

thanks for sample silverlight App, this was really helpful

#5 Pusat Belanja Online on 6.03.2009 at 5:23 AM

amazing article

#6 mark on 6.17.2009 at 7:00 PM

thanx a lot... this was really useful

#7 Stop Dreaming Start Action on 6.20.2009 at 6:55 PM

I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

#8 Rusli Zainal Sang Visioner on 6.20.2009 at 6:56 PM

information is truly extraordinary, I am very interested to read this post. thank you

#9 Radiokabel on 6.24.2009 at 6:03 AM

That means you can have your working application, or a video explaining it or maybe just a neat hero bar talking about the virtues of your project.

#10 Travelocity Coupon Code on 6.25.2009 at 3:43 AM

Is this still going on? I completely forgot about trying to put something together.

Regards,

#11 online blackjack on 6.26.2009 at 3:14 AM

It would seem that the thing people liked best about that post was not the animation itself but the way in which I included it inline with text.

#12 Custom Essay on 6.26.2009 at 4:14 AM

Many of these boards distinguished themselves with ANSI art, an early form of electronic cave paintings.Thats good to know about your site and it is really entertaining.

#13 Stubhub Coupon on 6.26.2009 at 9:09 AM

They worked a schedule of four days “in camp” and three days out, traveling between the mine site and the city by plane.

#14 moving on 6.26.2009 at 9:41 AM

we should move on

#15 israel education on 6.26.2009 at 9:41 AM

education is my life here

#16 jammer on 6.26.2009 at 9:41 AM

u impressed me alot

#17 San Francisco Movers on 6.26.2009 at 9:42 AM

is it that funny?

#18 Fireplace Designs on 6.27.2009 at 3:17 AM

The programming stuff really confuses me but it gives the users a good platform to work with. The interest lies in the designs.

#19 games on 6.29.2009 at 5:58 AM

It is good to organize the free and fun games which brings the spirit to play for the viewers.

Regards,

#20 Essay Writing Service on 6.29.2009 at 5:59 AM

That means you can have your working application, or a video explaining it or maybe just a neat hero bar talking about the virtues of your project.

Regards,

#21 Research Paper Help on 6.29.2009 at 6:01 AM

Please, can you PM me and tell me a bit more about this, I am really fan of your blog.

regards,

#22 Custom Essay on 6.30.2009 at 6:40 AM

The coding is informative to know about it and i would like to try once. Thanks for your share.

#23 Buy Essay on 7.01.2009 at 8:19 AM

Thats really good to know and i want to implement it and try in different manner. Thanks for your share.

#24 Essays on 7.01.2009 at 8:21 AM

Thats good and the coding is informative to know about it.

#25 online games on 7.01.2009 at 8:39 AM

That is great recipe you came up with. We are still experimenting and are not really sure how this experiment would end up, specially for Windows.

Regards,

#26 Rusli Zainal Sang Visioner on 7.02.2009 at 12:15 AM

Quite good trick but i want you to make it Better ur post because i use firefox 3.5

very bad css theme

#27 online paid surveys on 7.02.2009 at 2:35 AM

The happening with the laptop there is some hope that hard disk survived, I hope that servive center will fix your laptop.

Regards,

#28 motorbike accident claim on 7.02.2009 at 2:36 AM

The organic points are very good and this will create an idea to react properly in the future with the conditions they meet.

Regards,

Leave a Comment