Get Started

Before you ask about anything, check out our live demos.

How to add Silverlight Count Down to your project

All you have to do is:
  1. Download the latest release
  2. Add reference in your project to binaries
  3. Place control in XAML:
<UserControl x:Class="SilverlightCountDownTimerExample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:timeCounter="clr-namespace:SilverlightTimer;assembly=SilverlightCountDownTimer"             
    Width="200" Height="100">
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <timeCounter:SilverlightTimerControl EventDescription="Time to New Year Party" EventTime="2010-01-01 00:00" />
    </Grid>
</UserControl>

or XAML + XAML.cs
.XAML:
   <timeCounter:SilverlightTimerControl x:Name=”myCounter” />
.CS (C#):
   myCounter.EventTime = new DateTime(1983, 12, 14, 0, 0, 0);
   myCounter.EventDescription = "My Birthday";

Configuration options

EventDescription – Event's description. This text will be displaied in the bottom of control,
EventTime – Event time,
EventTimeUrl – Url to file with event's date. This file can be hosted on different server and when you modified it, event's time change dynamically. Example of file you can see here http://wpierdalaj.pl/SWG/date.txt. This file have to be accessible for your application (see Client Access Policy on Tim Heuer's blog. Because EventTime and EventTimeUrl, both set event's time, EventTime was chosen as a one with higher priority. It's mean that if you would like to use EventTimeUrl, you can't set EventTime parameter,
EventTimeCache – This parameter will let you turn on/off caching for event's time,
EventTimeCacheDuration – How long cache will remember saved event's date. If you set 40, application will not read new event's date for 40 days.

Events:
CounterFinish – This event will be invoked when counter finish his counting.

Example:
<timeCounter:SilverlightTimerControl CounterFinish="myControl_CounterFinish" 
         x:Name="myCounter" 
         Tooltip="CodeCamp Warsaw 2009 conference - 23.05.2009" 
         EventDescription="CodeCamp Warsaw 2009"
         EventTime="2009-05-23 09:00"
         EventTimeCache="True"
         EventTimeCacheDuration="2" 
         EventTimeUrl="http://wpierdalaj.pl/SWG/date.txt" />

Model-View-ViewModel (MVVM)

Silverlight Count Down also support binding, so you can set all parameteres using features of MVVM.
<timeCounter:SilverlightTimerControl x:Name=”myTimer” EventTime="{Binding Path=EventTime}" />

Last edited Jun 17, 2009 at 3:01 PM by DZaK, version 6

Comments

No comments yet.