Ranting and raving about anything I feel like complaining about.

Custom Control Creation (or Why Silverlight Needs a Blink Control)

Url: http://wildermuth.com/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:

Get Microsoft 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:

<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://wildermuth.com/downloads/blinkctrl.zip

 

 
 

Comments

Gravatar Wouldn't this custom control be more skinnable if used the VSM to control blinking?
Gravatar Yes it would but in an hour I didn't have time to VSM it. Go for it and i'll post the updated version!
Gravatar That Frank...always causing problems!
Gravatar Wouldn't this custom control be more skinnable if used the VSM to control blinking?
Gravatar Hugh,

I think I answered that already...
Gravatar "Silverlight - making the web fugly again" :)
"Silverlight - Not for epileptics" :)

There's a book you really have to read. It's called "Web Usability - Don't make me think" by Steve Kuller. He basically explains how users interact with a web browser.

Now the funny thing is that with some of the visual flexibility we've got in RIA, developers easily create really bad UI that no one else can understand :)
So blinking text, non-rectangular buttons, unusal mouse interactions, you name it.

Cool sample though Shawn.

-- Justin
Gravatar Ah yes, <blink> takes me back to the old-skool days of Navigator 1 . Maybe even the V.D.U. era when we blinked the text with escape sequences, because the users thought the effect was, "really neat."

What other 'retro' tags are there? Thinks, maybe the <Canvas> tag which is void thanks to Silverlight. But isn't this tag at the "cornerstone of cutting edge web design in 2009", to quote a UK design magazine. Nah.

My cursor is blinking. Cos I like it that way :-)
Gravatar It's good to know I can make the world a better place. :P
Gravatar Is this a bug?
In your Interval dependency property, there's:

if (source.timer.IsEnabled && source.timer.Interval != (TimeSpan)a.NewValue)
{
source.timer.Stop();
source.timer.Interval = (TimeSpan)a.NewValue;
source.timer.Stop();
}

Shouldn't the last line be:
source.timer.Start();
Gravatar Looks like a bug...thanks!

Add a Comment

*
*
*