Playing with Blocks: Episode 3

In my last post on the Silverlight drawing project I said I was going to stay away from the design and talk about code next. Quite a bit has changed, though, since then. For one thing the DrawStylus class has fallen victim to shrinking relevance and has been removed. The operations I initially envisioned for it kept leaping to other classes until it was nothing more than a forlorn wrapper around the mouse events. Oh well. Sometimes you have to be ruthless. Some additional classes have appeared, notably the StyleBox and StyleControl, which have about the same relationship as ToolBox and Tool, but are focused on editing styles. StyleBox derived from a StackPanel, and I’ve found that works very well, so I will probably be going back and changing ToolBox to derive from one as well.

Continue reading

To The Person Who Did This

I’m sure you felt, as I did, that today was a surprisingly fine day to be out in the Pine Barrens. The weather was sunny and warm, a rarity for February even in this mild state. The roads were very wet. That’s probably because there is still a layer of frozen soil a foot or so down that is preventing drainage, and creating the deep mud holes you and your buddies look for on days like this. Most people, myself included, don’t mind that you enjoy “mudding” in the Barrens. Despite the fact that you chew up the roads and make passage harder for everyone, we recognize that these woods belong to you too, and that you deserve to enjoy them. There’s a certain amount of cameraderie, however miniscule. We didn’t buy 4WD vehicles to drive on pavement either. So we wave and smile when we see you and your posse coming, mud dripping from every exterior surface, eyes bloodshoot and heavy-lidded, beer cans rattling around in the bed. Just some boys having some fun, is what I imagine most of us think.

And then you go and do something like this. I wonder if you know, or would care if told, that the road in front of the hole you were playing in was once the route of the Tuckerton Stage, which for many decades in the late 18th through middle 19th centuries was the fastest way from Camden to the shore; that the bricks your wheels were churning up (I doubt you noticed them) were hand made from Jersey clay, and once formed the foundation of Cranmer’s Tavern, a major stop on the stage road; that the depression you were spinning your wheels in is an unexcavated archaeological site dating to the colonial era, when the Pine Barrens hummed with industry, and towns like Mount, Washington, Harrisville, Martha, Hampton, and many others formed a web of life throughout the now-empty woods. If you haven’t heard of these places, you can be forgiven; not that many people have. But Mount, at least, you should know, because it’s the place you were trying to plow with your Gumbo Mudders.

You probably don’t know this, but many of the state forests in New Jersey do not allow much vehicle traffic at all. If, in the future, it happens that all of us are locked out of the Pine Barrens, we’ll have you to thank for it. Unlike you, the State knows that Mount was once there, and that Cranmer’s Tavern was once there, and the good people whose charge it is to see that neanderthals like you do not rob future generations of their heritage for an afternoon’s thrills don’t like to see people driving their trucks through archaeological sites. That’s why there’s a fence at Martha, and ten feet of earth over everything of interest. That’s why there’s a fence at Harrisville, or at least that’s why there was one, before people I imagine to be very much like you started ripping it down. In the end, it will be a lot cheaper to just ban vehicles than to fence off everything you try to destroy.

Do us all a favor: stick to the roads from now on. There is plenty of deep stuff for you on marked ways. If you can’t manage to stop acting like the entire forest was placed there for the sole purpose of your thrill-seeking enjoyment, then none of us are going to have access to it at all. And that would be a shame.

WPF Container Controls and Layout

I see a lot of questions on the Silverlight.Net forums about control layout. Typically they follow the general pattern “I placed a {insert control} into a {insert container}, but {insert problem} is happening. Can you help?” I thought it would be useful to cover the main types of control containers available in WPF and Silverlight, and catalog the differences in their default behavior with respect to layout.

Continue reading