This HTML 5 thing sounds magical…

Steve Jobs certainly makes me want to check out the magic that is apparently HTML5.

Steve Jobs on Why He Knows Flash Sucks and isn’t worthy.

It’s amazing how apparently HTML5 solves all problems and is the best platform for doing modern application development.

Oh wait.

No, as the vast majority of applications for Apple’s mobile devices are written using native solutions (in Objective-C), with some subset using embedded web-browsers as needed. Very few are pure web.

HTML 5 clearly is the perfect development platform for all applications.

Seriously, if you’re thinking of creating an application for mobile – I too suggest you to consider creating the application using modern HTML standards rather than Flash. On that I agree with Mr. Jobs. (Especially if you’d like to have owners of Apple iPhone/iPad/iPod be users of your application).

(Aside: I do think this “Flash = Video” thing really sucks and Adobe should spend more time proclaiming that there’s more to Flash than just video. I really like the Flex framework and what AIR has done for the development community. And seriously, when is the last time you saw a really good HTML4/5 game? It’s still too hard to build things like that in pure HTML.)

Do not however choose the completely proprietary and closed system that exists for Apple mobile products using XCode and Objective-C. It’s a dead end from a portability perspective (especially after Apple banned portability platforms).

What do you do if you need lower-level access to things that aren’t available thru the HTML layer? Ask Steve about that apparently. It’s magical – so either it’s there, or you apparently didn’t need it.  (I’d actually consider creating a native app in this case and wrapping the browser and making it a blended experience with as little in the native application as possible).

It’s pretty simple to create a manifest file for your web application so users can add it to the iPhone experience as a icon that will act like any other iPhone application (you can even hide the “safari” chrome). 

By creating a mobile web application, it will be accessible on many phone and new device platform categories (maybe like the new webkit powered TomTom GPS for example).

Silverlight ChildWindows and VisualStates

Unfortunately, as of the latest version of Silverlight 4 and Blend 4, there’s a feature supportability mismatch. Blend 4’s designer may lead to you to believe and expect that VisualStates will work within a Silverlight 4 application. (It led me down that path).

In fact, VisualStates do not work directly inside of a ChildWindow. VisualStates are only applicable on the root element of a ControlTemplate or UserControl (as described here). I just spent the last 20 minutes learning about this limitation the hard way – by trying it, over and over. :)  It’s not a bug, it just isn’t supported.

If you want to use VisualStates within a ChildWindow, the simplest workaround for this problem is to wrap the content of the child window into a new UserControl and place that UserControl in the ChildWindow (as a child). You’ll need to do a little more work to expose the functionality of the UserControl to the containing ChildWindow (like OK/Cancel button handling for example), but it’s simple work. I added an event which indicates the child window should be closed:

public event EventHandler<CloseDialogEventArgs> CloseDialog;
public class CloseDialogEventArgs : EventArgs
    public bool? DialogResult { get; set; }

    private CloseDialogEventArgs()

    public CloseDialogEventArgs(bool? dialogResult)
        DialogResult = dialogResult;

    public static new CloseDialogEventArgs Empty = new CloseDialogEventArgs();

Then, it can be closed:

private void CancelButton_Click(object sender, RoutedEventArgs e)
    if (CloseDialog != null)
        CloseDialog(this, new CloseDialogEventArgs(false));