Rants and Raves

Thanks for visiting my blog!

Custom Control Creation (or Why Silverlight Needs a Blink Control)
Custom Control Creation (or Why Silverlight Needs a Blink Control)
January 22, 2009

Url: http://wilderminds.blob.core.windows.net/downloads/blinkctrl.zip
Silverlight Logo
The worst ideas seem to start up on Twitter.  Really I blame Frank LaVigne. There was a short discussion of comparison something to the Blink tag in HTML (e.g. they were trying to disparage it). Then Frank in his own brand of wisdom said that someone should build a Blink tag for Silverlight:



The last thing I needed today was a distraction from the ASP.NET MVC work i've been doing...but an hour down and I had a control that mostly worked.  I created the simple custom control so that users could specify a Text String, font properties, a blink interval and a blink color.  For example the control can be used like so:

```csharp
<Grid x:Name="LayoutRoot"
      Background="White">
  <useless:Blink Text="Am I Blinking?"
                 FontSize="24"
                 Interval="0:0:0.25"
                 BlinkBrush="Blue"
                 />
</Grid>

But then I figured this was a good example of any how to create a simple template-supported control (e.g. supports ControlTemplates) and dependency properties. I will leave the discussion of whether this is a good idea for a control to another blog, but if you want a quick example of a small custom control, grab the code and take a look.  I am open to any suggestions to put it up on CodePlex for the community to elaborate.  The code is here:

http://wilderminds.blob.core.windows.net/downloads/blinkctrl.zip