Monday, 2 June 2008

Homer H1: Install and play

For my first session on my new lunchtime learning project I:
  • Installed .Net 3.5 (I already have vb6, vs 2003 pro and vs2005 dev but haven't moved to 2008 yet).
  • Installed Blend 2.5 March 2008 preview
  • Started learning the hard way....

Ok I should have read a load of tutorials, poured over examples etc but what I choose to do was play all the samples and then start trying to animate an ellipse. This is when it all started to unravel. Here's what happened:

  • I started MS Expression Blend and added a Silverlight Project (VB.Net version).
  • I drew an ellipse.
  • I added a storyboard, moved the ellipse and stopped the recording.
  • I pressed play and nothing happened so I moved the little mark in the timeline.
  • With the ellipse animated I added a button.
  • I spent 30 mins trying to connect the button click to the ellipse anim.

I turns out that the help files description of "Add or remove a trigger" no longer applies to this build of Blend when working on Silverlight projects (see: Where is the Triggers Pallet in 2.5 March). So I attempted to hook the event manually as suggested in the last post in the thread but in Vb.Net, this resulted in:

Page.XAML.VB

Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Partial Public Class Page
Inherits UserControl
Public Sub New()
InitializeComponent()
End Sub
Public Sub Mouse_Clicked(ByVal sender As Object, ByVal e As MouseEventArgs)
Call storyboard1.Begin()
End Sub
End Class

This caused a "type 'MouseEventArgs' is not defined" error. It turns out that it should be defined as RoutedEventArgs (see Create a new event handler method).

The end result is below (21kb wmv from Windows Media Encoder 9)

That's it for now.

No comments: