|
I have been trying to consolidate. Most of my work is here, in this blog, and for this site, but I also have a Blog for O’Reilly and a political Blog, and a page where I list the books I’ve written, and a support site and… About a year ago, I migrated away from my business web site and set up a “ portal ” to all my on-line “presences.” which, frankly, I slapped together. It is ugly, but its concept is to show an image that is a link to each site or blog. Since I’m about to tape a series of videos on Templates and the Visual State Manager to coincide with releasing a tutorial on the subject, I thought I’d “play” with the idea of replacing the static images with buttons. Each image could be hovered over and would grow (and identify itself), could be clicked on, etc. It turned out to be a pretty easy exercise (like many things, a couple hours to figure out, but the next time will take 5 minutes) and will both make a good exercise for the videos and will make my site nicer (once I get around to (a) perfecting the buttons and then (b) switching the rest of the images over!) For now, you are welcome to take a look , (if you do, be sure to hover over a button, and even more fun, click in the control but not on a button and then hit tab, changing focus). Just Xaml The point of this blog post, however, is that a buddy (who is a killer javascript programmer and the best high school math teacher on the planet ) wrote to me and asked “how did you make them spin” and in explaining (briefly) i realized that it might be interesting and surprising that there was no non-declarative code; everything was done in Xaml. What I’m about to write will make a lot more sense after you read the tutorial and see the videos but I’m going to capture it today as I have it in my head, so forgive me for putting the cart of details before the horse of introduction. Image rotation, and everything else (making it larger, etc.) is just a transition based on the “state” (mouse over, etc.) . There isn’t one line of code in there; it is all declarative Xaml. <vsm:VisualState x:Name= "Focused" > <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime= "00:00:00" Duration= "00:00:00.0010000" Storyboard.TargetName= "thePanel" Storyboard.TargetProperty= "(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" > <SplineDoubleKeyFrame KeyTime= "00:00...
|