Using the Code
Here, we will see a different file separately. Before you start using Silverlight, you have to download the Silverlight Plugin.
container where the Silverlight control will be loaded. Below this, get the
Container object and call the function
var parentElement = document.getElementById("DigiClock");
This file has to be downloaded from the Internet. This file will contain the methods to create a Silverlight control and other helper methods.
createMySilverlightDigiClock() - This method will be called from the DigiClock.htm file which will create a Silverlight control, where you have to specify the XAML file name, your
container name, width and height of the Silverlight control.
ShowNumber(sender,num,strTime) - This method will show the number in the display depending on the parameters passed.
sender - Silverlight control object
num - Number to show in the display
strTime - Variable containing the place where this number has to be shown on the display board
OnLoad() - This method will be called on load of the page where the Silverlight control will be stored in a global variable called
ClearDisplay() will be called to clear the previously displayed number. Then, call the
ShowCurrentTime() to show the present time in the display.
ClearDisplay() - This method will clear the number in the display. This is done by changing the
Opacity of the Polygon. This property (
Opacity) will take the value from
0 will not show the object and
1 will show the object with full color.
This file is the most important file where you have to define all the shapes you are going to use in your application. Here, I have created a single digit with seven polygons and each polygon's
Opacity will be changed depending on the time.
Note: I have also added my name at the bottom using PolyLine and Path Elements.
Points of Interest
I am working with .NET for the past 4 years. My areas of interest include .NET, AJAX and other new upcoming technologies.
- 5th July, 2007: Initial post