Featured Posts

The WPF Must-Grok List Robert A. Heinlein defined the word grok as: Grok means to understand so thoroughly that the observer becomes a part of the observed—to merge, blend, intermarry, lose identity...

Read more

Yes, Virginia, TextBlock.Text Will Support MultiBinding One of the features introduced to WPF in version 3.5 SP1 is the StringFormat property. If you’re unaware, StringFormat allows you to bring the String.Format capability...

Read more

Why Are WPF Developers Trying to Kill Menus? Somewhere along the line, and I’m not motivated enough to research it, menus apparently became bad.  I don’t mean they ever stopped working or became unsuitable for the...

Read more

WPF: What it is and What it is not Even though WPF has been around for a number of years, there is still some confusion as to what WPF is and what it is not.  Here are a few items that come to mind: What...

Read more

using System.Windows; Rss

Silverlight Experiment post-mortem

Posted on : 24-11-2009 | By : Christopher Estep | In : Silverlight

Tags:

0

Well, I finished my experiment with Silverlight, specifically Silverlight 3.  If you recall, the aim was prove to myself that I could translate my WPF skills into Silverlight and how quickly.

Mission accomplished! 

I made a number of Silverlight controls and small apps and I was very pleased with how easy that translation was.  Initially, i was going to make an Amazon widget, which I may still do at some point, but I abandoned it about 3 hours into doing so because by that time, I’d proven to myself that I could easily take what I know in WPF and downgrade them into Silverlight and what remained for that widget was more fine tuning than development and didn’t serve to be a test of my skills.

So I chose to venture into other areas of Silverlight and with very little exception, I found that WPF skills do scale down to SL quite well.

I know some Silverlight people might object to my terminology such as “downgrade” and “scale down” but let’s be realistic.  That’s what it is.  There is so much you can do in WPF and do it more easily than you can in Silverlight that detailing the differences would be far beyond the scope of this post or my blog (at least for now).  Remember that from the outset, Silverlight was intended to be Windows Presentation Framework, Everywhere.  And to a large degree, that’s what it is.

The bottom line for me is that I can do both with equal aplomb.  There are nuances to each, but even those are becoming less obvious.  For instance, Silverlight uses “states” where WPF does not.  Or does it?

WPF version 4 is now in Beta 2.  One of the many things that have been added in WPF version 4 is the official inclusion of the Visual State Manager.  I say “official” because it’s been available to developers of WPF for quite some time, but it’s an out-of-band download in the WPF Toolkit.

Convergence is the order of the day in what I like to call the XAML-space.  Many WPF developers felt slighted at PDC 09 because of the prominence of Silverlight 4 and the complete absence of WPF in both keynotes.  I even saw many people on Twitter saying that “WPF is dead” though I don’t agree.  The technologies are coming closer together and I find it ironic that what some people are saying is “dead” is actually closer to the WPF/Everywhere vision that was originally intended.

Having said that, I think that Silverlight is still a niche product and should be treated as such.  Unless you have cross-platform concerns (MS still owns over 90% of the desktops) or are going to need the expected future Silverlight on mobile, WPF is still the best choice for the desktop.

Remember, to the man with a hammer, everything looks like a nail.  Just because you know web application development doesn’t mean that every application should be a web application.

Popularity: 19% [?]

Silverlight Proof-of-my-Concept Update

Posted on : 12-11-2009 | By : Christopher Estep | In : Silverlight

Tags: , , ,

0

I’ve been busy on my Silverlight test control and it’s been more fun than I’d expected and it’s actually been a lot easier than I’d expected, too.  So what I’ve been doing is delving into some of the more internal differences to extend what I’d originally planned further.

From a layout perspective, Silverlight 3 is very similar to what I would do in WPF, but it’s much more basic.  You can do many of the same things, but with Sl, it’s pretty scaled down.  By this I mean that WPF is a richer framework and handles some of the details that you otherwise have to do manually in Silverlight.

One thing I’ve noticed is that Silverlight is very lean with its overloaded constructors.  I’m not complaining, it’s an observation.  I’ll give a real example.

In WPF, I could make a rotate transformation like this:

  child.RenderTransform = new RotateTransform((angle * 180 / Math.PI));

The problem  with doing that in Silverlight is that RotateTransform only has the default constructor.  Fortunately, C# 3 included Object Initializers, so the alternate syntax I have to use is completely painless:

  child.RenderTransform = new RotateTransform()
       { Angle = (angle * 180 / Math.PI) };

How awesome is that?

So you still have the benefit of a lighter footprint without the overloaded constructors (which are just get/set anyway in this case), but still painlessly instantiate and initialize the object.

There needs to be a word of caution to newer programmers.  Don’t assume that you can universally bypass all overloaded constructers using Object Initialization as I’ve done above.  While a significant number of such constructors are nothing more than get/set convenience mechanisms, this is not the case every time.

Object Initialization is easier to read than a parameterized, overloaded constructor.  Just don’t forget that constructors can (and often) do more than just initialize properties.

Know your code!

Popularity: 7% [?]

Silverlight Diversions

Posted on : 10-11-2009 | By : Christopher Estep | In : Silverlight

Tags:

0

I was asked during an interview today how well I could translate my WPF skills to Silverlight.  Naturally, I answered that I would be able to do so very quickly.  I consider that confidence, rather than bravado.  I’ve been writing software for over 20 years and to me, a language or technology is simply a means to an end, which end is the final product.  I’ve been fortunate enough to have been blessed with a talent for software development which has enabled me to work in a very diverse range of environments and platforms.

I’m fond of sayings and one popular saying is “put your money where your mouth is”.  Anyone can say or claim anything, especially in a job interview.  I don’t like being lumped in with the crowd and it’s to my detriment that I haven’t been able to point to a completed applet or application as even a small example that I’ve done it.

So, I’m going to take a very short diversion.  I’m going to put something together in Silverlight 3, just so I can have something as even a small example.  The problem was deciding what to write.  Fortunately, there is a wealth of things on the Internet that I think can be improved.  One of these is the restrictive way that Amazon Associate widgets are created.  It’s bad enough that they’re in Flash, but they have limitations that I simply don’t care for.

So I ask that you bear with me as I briefly step into Silverlight land (briefly, as far as this blog goes, that is) and prove my own concept.

I’ll be sure to post here what I’ve done.

Popularity: 7% [?]