Sharing my knowledge

Silverlight 2 released

Silverlight 2 is out now with new features like rich set of controls, improved Text Rendering capabilities, rich networking support including calling secured(SSL) services etc...

Moreover Microsoft is partnered with Soyatec to sponsor tools for developing Silverlight applications using cross platform Eclipse development platform. eclipse2SL is first of that kind.

eclipse2SL is an open source tools integrated with the Eclipse development platform that enable Java developers to use the Eclipse platform to create applications that run on the Microsoft Silverlight runtime platform. Specifically, the project will be an Eclipse plug-in that works with the Eclipse Integrated Development Environment (IDE) and Eclipse Rich Client Platform (RCP) to provide both a Silverlight development environment and greater interoperability between Silverlight and Java, to facilitate the integration of Silverlight-based applications into Java-based web sites and services.



1px line issue in silverlight

You might have noticed an issue when creating a line with 1px stroke thickness, when rendering the stroke thickness is more than 1px which is not we are expecting.


Output of this looks like below


Actually this is happening because, the rendering algorithm used inside.


So what we need to do to fix this issue......???

Fix: Very simple, add a translate transformation of 0.5 for both X and Y axis.



Now if you run, u will get a correct 1px line.


Creating a custom silverlight control

Download the complete source code from here

In this post, I will explain how to create a custom control in silverlight. The control we create is a simple control which will draw a circle, the radius of the circle is controlled through the exposed public property.

This is a simple control, but hope this will give you an idea about the approach to the custom control development in silverlight.

Create a the Silverlight class library project first


I have named the solution and project as "SimpleControl", after the class library is created, you will get a default class "Class1.cs"