1
2
3
4
5
6

June's Grab Bag of Fun

The last month or so has been pretty hectic both at work and in my personal life - but rather than make excuses or promise to blog more frequently, I'll instead just post a grab bag of random tidbits I've learned / come across this month.

First Screenshot of the Windows Phone 7 Launch Screen in Landscape


Original screnshot from CNET

Having played with the hacked emulator quite a bit I'd grown concerned at how few apps so far supported landscape orientation - including the main launch screen of the phone. I am pretty sure that this screenshot above is the first shot of the launch screen running landscape, which is nice to see. I am very hopeful that the WP7 team might update their Windows Phone 7 Series UI Design & Interaction Guide to discuss more about landscape orientations, and that more videos or screenshots might come out showing how native apps will handle this orientation.

Some New Understandings about the Visual State Manager in Silverlight
Two of the biggest issues I'd run into using the Visual State Manager was the inability to know when a state transition had completed, and the ability to query the current visual state. Thanks to this month's presentation at the Atlanta Silverlight Meetup by James Chittenden I now know the solution to both of these issues.

It turns out that in Silverlight 3 you actually CAN tell when a visual state transition has completed. I had asked around to several folks about this, so apparently I wasn't the only one in the dark on this ability. It is actually very simple. Supposing that the name of your visual state is 'MyState', attaching a completed event is as simple as attaching a completed event to the relative Storyboard:

MyState.Storyboard.Completed += new EventHandler(Storyboard_Completed);

New in Silverlight 4 is the ability to query the current visual state of your control. Supposing that the name of your visual state group is 'MyVisualStateGroup', you can check the current state like so:

string currentStateName;
if (MyVisualStateGroup.CurrentState != null)
    currentStateName = MyVisualStateGroup.CurrentState.Name;

Windows Phone 7 Development Continues...
Finally, I just wanted to point out that I am still working on Windows Phone 7 applications - both at work, and in my personal time. Brandon Watson and others have recently commented that developer devices will start rolling out in July, and that those who want a test device need to be showing off their work. I hope to post some information as to the initial apps/games I hope to have in the marketplace on launch soon - and if you want an early test device, I suggest you do the same.

Windows Phone 7 Tools Are Here, Time to Get Crackin'

I just got back from 5 days in Vegas for Mix 2010 (where I was a top 5 tweeter). Hopefully by now you've watched the first day's keynote and seen some of the awesomeness unveiled. If not, I'd highly suggest checking it out for demos of Netflix, Four Square, graphic.ly, and other apps running on Windows Phone 7. You'll probably want to check out the sessions on the marketplace, the 'Metro' design, etc. but once you're done you'll probably want to get crackin' writing apps for Windows Phone 7, so I threw together a grab bag of handy links to get you started:

Windows Phone Developer Blog
Windows Phone 7 Series Forum
Community Resources for Windows Phone Development

Videos of MIX10 Windows Phone sessions
Windows Phone 7 Series UI Design & Interaction Guide
Free ebook: Programming Windows Phone 7 Series (DRAFT Preview)
Developing applications and games for Windows Phone 7 Series
Install checklist for Silverlight 4 RC, Blend 4 Beta and Windows Phone Developer tools from MIX10

While not directly related to Windows Phone 7 development, these other recent links can come in real handy when developing for Windows Phone 7 Series:
.toolbox - a cute site teaching basic design concepts
Silverlight Training Course (Silverlight 4)
Visual Studio 2010 XAML Editor IntelliSense Presenter Extension

It should go without saying, but my primary focus going forward right now is Silverlight development on Windows Phone 7 - I am sure I'll be posting quite a bit on it in the coming months.

Silverlight Tips Grab Bag for November

I haven't written a grab bag in a while, so here is a rather impromptu set of tips from lessons learned in developing full-time in Silverlight the last several months. I hope to get better at blogging these things more frequently, but hopefully this grab bag will be useful to some.

Have Good INotifyProperty Snippets

There are several Visual Studio snippets on the web relative to implementing the INotifyProperty interface and corresponding properties in Silverlight. You should find snippets that fit your style and know how to tweak them if needed - you can edit these snippets easily in notepad.

The images below link to their corresponding snippets attached to this post - these are the snippets I'm currently using. You can use the notify property snippet with the keyword notifyp, and you can use the INotifyPropertyChanged implementation with inotifyp. You'll want to save both of these snippet files to your ..\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets\ folder.

  

The main thing to note is that the setters for the properties are comparing the values and only firing the notification if the value actually changed - this helps prevent firing events that update listeners and UI when the value didn't actually change.

(more after the break..)

Getting Started With WPF

I wrote the following blog entry for my company's intranet a few months back and had been meaning to share it publicly. Hopefully it will be of use to people trying to learn WPF from scratch:

Getting Started with WPF

Books:

WPF Unleashed - When I first went to a microsoft event over a year ago to talk about silverlight and WPF I was told that this book was the best book on the subject. I picked up a copy and let it sit on my shelf until almost a year later - and it was still considered one of the best books on the subject. This book is highly focused on XAML and UI creation in WPF, and is a good basis for learning XAML markup - expect to read a few pages, then play with the XAML, read a few pages, play with more XAML, etc.

Programming WPF - I recently picked up this 800+ page book and now that I am 150~ pages in I can firmly state that this book is worth the read. This book is almost the exact opposite as WPF Unleashed in that it talks very little of XAML, and focuses more on programming with WPF applications. Think of it as if you bought a book on coding WinForms applications - it wouldn't just cover the UI designer in Visual Studio, it would cover the hundreds of other things you need to know to create and distribute a real app. This book goes great with WPF Unleashed as they both cover totally different subjects. I also like that I can read this book for 20-30 pages at a time without doing any playing, instead mostly just trying to learn the technologies that are involved in WPF.

Tools:

Kaxaml - Kaxaml is like XamlPad if you have played with that. It lets you write up loose XAML files and see what they look like real time. It was developed by a member of the Blend team, and the guy who runs nerdplusart.com (a blog worth following). This tool is a must have, and is without a doubt the best way to learn how to code XAML by hand (see tips below).

Expression Blend - This tool is sort of a devil in sheeps clothing. It is a really great application, but much like FrontPage it can be the creator of evil when it comes to XAML. It is worth learning Blend for advanced functionality such as animation, tweaning, paths, and maybe complex gradients, but it should in no way replace the need to know XAML itself. When you get Blend be sure to get the latest version - Expression Blend 2.5 June 2008 Preview, and be sure to check out this blog entry for how to get intellisense in Blend.

Video Resources:

WPF Boot Camp 2008 - There was a 3 day boot camp on WPF put on by IdentityMine (the company the creater of Kaxaml and owner of nertplusart.com works for) and other WPF top dogs earlier this year. This site has all the video footage from this boot camp, and best of all it is all free. When downloading the videos make sure you download the ones with '2MB' in the name if you want the highest quality (although the mp4 ones work pretty well for the iPod Touch as well). You can download these and watch them when your eyes get tired of reading books on WPF, that way you can become a total WPF learning zombie.

Lynda.com Expression Blend Videos - Lynda.com has about 6 hours of video training available for free on using Expression Blend. I would suggest you put these off until after you can write a whole UI and its resource dictionaries by hand in Kaxaml.

WindowsClient.net WPF Videos - WindowsClient.net has a section dedicated to WPF videos, these tend to be pretty short and to the point, and videos are being added about 1-2 per week.

General Tips:

  • Learn how to code XAML by hand before you even bother with Expression Blend. A recent interview on hanselman.com between a WPF designer and a WPF developer was very insightful to me. The designer made the point that much as no self-respecting HTML designer would only use generated HTML by Dreamweaver, no self-respecting XAML designer will ever use tools like Expression Blend without tweaking and improving the generated XAML by hand. You should get to know XAML by hand, and then use Blend to speed up the development of more complex features of XAML such as animations, etc. Get Kaxaml and learn the XAML first.
  • Being able to reproduce examples does not mean WPF is as easy as it looks. Many quick demos show off the 'wow' factor of Blend and how easy it is to make a Flickr browser for example, but this does not translate easily to a real application which you might need to create. Don't always just do examples in books or video tutorials, take the time to try and create something else on your own and see all the roadblocks you run in to and need to research.
  • Practice, Practice, Practice - the only way you are going to learn XAML is to do it. Expect a rather large learning curve, and become best buddies with Kaxaml.
  • There are significant changes to the application, window, and command models in WPF - be sure to suppliment learning XAML with learning the new programming techniques that go along with WPF as well - the aforementioned 'Programming WPF' book is essential for learning the real meat of WPF beyond just the XAML markup.
  • Web Resources:

    http://j832.com/bagotricks/ (the WPF bag of tricks contains full source and a demo executable showing off some of the k-rad advanced things you can do in WPF)

    http://windowsclient.net
    http://www.dotnetkicks.com/ (use the WPF tag)
    http://blogs.msdn.com/expression/default.aspx (Expression Blend Team blog)
    http://blog.nerdplusart.com/
    http://www.hanselman.com/blog/ (use the WPF tag, and read about Baby Smash)
    http://www.nibblestutorials.net/
    http://robburke.net/
    http://www.smartypantscoding.com/

CodingTags: 

Another WPF Grab Bag

I'm still playing with WPF pretty routinely. I haven't posted much because I'm enjoying learning and playing more than writing about it, and honestly there is such a wealth of tutorials (in video, book, and article formats) that me writing about it is pretty useless unless it is covering some issue I really struggled with. I am considering writing a getting started with WPF guide eventually though, because all of the great resources for learning are spread around in a million places.

So far I am not running into major roadblocks, other than perhaps small things like using XMLDataProvider for an XML data island in XAML - if you do this always be sure to put xmnls="", because if no namespace is defined (even a blank one) then your bindings will not work - because it inherits the namespace of the XAML document itself. Little stuff like this really doesn't warrant writing a whole article, its just one of those little things you pick up on. So, until next time I'll just post more k-rad stuff going on with WPF..

First off, .Net 3.5 SP1 was released on Monday - the word on the street is that this is the 3rd major revision to WPF, with the first being .Net 3.0, the second being .Net 3.5, and then now 3.5 SP1 - it sounds like WPF really got a bunch of focus in this service pack. It includes a built in DataGrid for WPF, moves bitmap effects to the hardware tier for better performance, includes built in support for quick loading splash screens, and new control named D3Dimage - a way to use Direct3D right inside WPF. There is a video right now on Channel9 which shows off some of the new graphic abilities in SP1, it is definitely worth checking out.

I just got my hands on a new book, Programming WPF, after reading a ton of Amazon reviews. I would post more in this blog entry, but honestly I'm ready to get crackin' on this new book - until next time!

CodingTags: 

WPF Link Grab Bag

So I've been under the weather (or at least that is one of my excuses), so I don't have the next part of my WPF series ready to post yet, but I do have a couple of links to fill your time.

First off, the latest Hanselman podcast is up. Apparently the creators of Line Rider have converted from Flash to Silverlight. This interview should be pretty interesting, you can find it here.

CodingTags: