| Comments

Just a quick shout-out to congratulate the latest Silverlight MVPs to the program.  The Microsoft MVP (Most Valuable Professional) program is a recognition program that is in place to recognize and reward those individuals who have been identified by individuals (peers, Microsoft staff, etc.) as experts in their technology field and global contributors to the technology. 

Microsoft MVP logo

As of today (01 OCT 2010) we welcome some new folks to the Silverlight group:

All of these folks are great participants in the Silverlight ecosystem and their local geographies and I congratulate them for their efforts.  Be sure to check out all the Silverlight MVPs and subscribe to their blogs!  Thanks to all of you for helping make a great developer ecosystem!

This work is licensed under a Creative Commons Attribution By license.

| Comments

On the heels of the Windows Phone Developer Tools and Silverlight for Windows Phone Toolkit releases I saw a lot of exhaling going on in the hallways today.  Apparently Jeff saved his largest one for an avalanche of knowledge on Twitter in the late afternoon.  Jeff Wilcox is a developer on the Silverlight team and has been working on the Silverlight for Windows Phone initiative as well as the toolkit released today.  He was headed out on vacation but decided to throw out some words of wisdom for Windows Phone developers working in Silverlight.  Here’s some of those nuggets – I wanted to capture them before he left because who knows how long they’ll stay in Twitter.  It reads like a true guide to developing great apps on Windows Phone…

  • Panorama looks nice, but Pivot will offer faster start time.
  • You can also set a Background image to a Pivot. You won't get the parallax effect, but it is another option.
  • Be aware of how many pano and pivot items you do have. Memory expands quick when you have a lot of views and images!
  • Even if you have a 30k compressed JPEG image, at runtime that becomes an uncompressed surface that may take several MBs of memory
  • Pivot and Panorama can have UI element headers and titles, too, but you'll need to apply your own styling (fonts and sizes)
  • Beware that UI elements larger than 2000x2000 pixels that are bitmap cached clip on Windows Phone 7. We know it isn't perfect, but beware k?
  • Setting SelectedIndex before the items are set on a Pivot causes an exception. Wrap in a try/catch or wait for loaded (sorry!)
  • A slideshow app in 5 minutes: Pivot with null Header and Title and item headers. Beware memory use though.
  • A lot of people try building 'wizard' screens with panorama & pivot control. Please don't do this! Thx, the "UX gods"
  • Layout is a killer. But like death, you eventually have to pay it for everything.
  • So consider delay loading controls and screens. A Panorama with a billion items will take forever to load due to layout.
  • If you're not using PerformanceProgressBar, I'll send @JustinAngel after you ProgressBar for Windows Phone 7
  • If your app rocks and starts really quick *on a device* consider not using a splash screen
  • It's true. Your 6-core machine running the wp7 emulator is NOT indicative of device (single core!) performance. Beware!
  • We've talked perf before... Content over Resources for images means fast startup time http://bit.ly/9DhVbd
  • If you're using Panorama, a Resource background will load immediately compared to Content
  • Remember that for ingestion to the marketplace, your apps need to consume under 90MB of memory
  • However on devices with > 256MB, its cool to use more *in those cases
  • long deviceTotalMemory = (long)DeviceExtendedProperties.GetValue("DeviceTotalMemory");
  • long applicationCurrentMemoryUsage = (long)DeviceExtendedProperties.GetValue("ApplicationCurrentMemoryUsage");
  • long applicationPeakMemoryUsage = (long)DeviceExtendedProperties.GetValue("ApplicationPeakMemoryUsage")
  • Your compositor thread should rock out around 60fps all the time please. #wp7dev perf counters: http://bit.ly/busJIi
  • If your UI thread gets pegged, your compositor thread will suffer... remember your BackgroundWorker kids!
  • Unfortunately the "Analytics" type from desktop Silverlight is not on the phone today, so you can't measure CPU in a regular app
  • Having a single DispatcherTimer in your app can affect your battery life regardless of interval. Chose wisely
  • You can set the Foreground property on Pivot to set the title and header text color
  • Using a map control inside a Panorama or Pivot is not recommended for a number of UX and technical reasons. Navigate to a subpage.
  • Please use text styles and never hardcode sizes or default fonts.
  • The panorama/pivot items expect most their contents to have a 12px margin left/right for UX reasons. The default styles have this.
  • So if you have something in a pano/pivot item with 0 margin & padding, your UX will be funky
  • Fill rate is super important. Keep it under 2.5 please
  • What is fill rate? 1.00 means one screen of pixels being rendered every frame.
  • Check your apps for extra, un-needed background colors on pages, controls, etc.. They impact perf.
  • That sexy "tilt" effect? Use Peter's behavior http://bit.ly/90Z1yR and/or check out the MSDN docs
  • DataTemplates with a bunch of StackPanels and Grids? Try to simplify to a Grid with the right col/rows instead for perf wins.
  • Unit testing in a quick and dirty way is possible on the Windows Phone thx to the sl unit test fx. http://bit.ly/a0DWah
  • Only use Dispatcher.BeginInvoke when you must. Look at SmartDispatcher (ps old code sry) http://bit.ly/axHh36
  • For a "wide" Panorama item, set the item's Orientation to "Horizontal"
  • Play with the cache and redraw vis. settings to see what's being cached in your app http://bit.ly/busJIi
  • Things in a list/scroll viewer are often automatically bitmap cached by Silverlight for Windows Phone runtime
  • If you have a progress bar with IsIndeterminate="True" in your app, even if its hidden those storyboards are costly! Set to False!
  • We did work on Windows Phone 7 to move more networking to the background thread - hope it helps
  • When a Panorama loads, all its items go through a render pass. For pivot, it is done incrementally for neighboring items.
  • When making web requests, see if the service lets you scope down the fields that are returned for quicker perf (and JSON over XML!)
  • If you navigate to a subpage, the old page will stick around - so complex pano/pivot pgs stay in memory unless you're proactive
  • The "app deployment tool" installed with the dev tools lets you run others apps in emulator/device without needing source
  • We optimize for loading some things from isolated storage. Images from an isostore stream may load faster than a MemoryStream
  • If your source files have "Black" or "White", you might be doing it wrong. PhoneForegroundBrush, PhoneBackgroundBrush instead!
  • If your control's dep. property has a change handler, animating that prop. will always happen on the UI thread (no gpu accel.)
  • Animating Opacity on a CacheMode="BitmapCache" element = compositor thread (GPU!)
  • In the RTM tools, scroll viewers all have the "bounce" effect automatically
  • If you ignore the phone's theme (and go all light bg, like the mail app), your scrollbarsmust be retemplated or you won't see them!
  • Although data binding is not evil, an observable col. with a complex data temp. and 200k items is evil.
  • The web browser control won't let you NavigateToString until it has loaded.
  • If you have an app with a lot of different web browser controls, think about consolidating to one, so it only has to load once.
  • Panorama is designed to be a starting place. Think whitespace. Not tons of data
  • Free performance win: when you use Panorama the way the UX guidelines recommend, it is faster! http://bit.ly/9zTxtU
  • Those theme xamls for #wp7? Yeah they are in %ProgramFiles%\Microsoft SDKs\Windows Phone\v7.0\Design\
  • Resist the urge to Panorama every app.  It is a sweet UX thing when used right…but not just because.
  • Resist the urge to iPhone gradient your apps. Think outside the box! Also it avoids color banding...

So as you can see, he sort of knows what he’s talking about :-).  Go subscribe to his blog and follow him on Twitter.  Other helpful links:

Thanks Jeff for sharing your awesomeness!

Hope this helps!

| Comments

Well, the official Windows Phone Developer Tools are out!  Go get them. (warning likely some caching issues..direct installer here.)

The awesome Silverlight toolkit team is at it again, this time for Windows Phone 7.  The team is releasing a series of controls/libraries to help WP7 developers fill some gaps and simply make things easier and more consistent.  The initial set includes the following:

These controls are available for download including the source code.  Here’s a quick synopsis of them for you to enjoy.  Note that the “toolkit” prefix on the controls is declared in the app as:

   1: xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
   2: xmlns:toolkitPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit"

after adding a reference to the Microsoft.Phone.Controls.Toolkit assembly.


In WP7 there is a notion of a context menu, where when the user holds down an item (tap and hold) it pops up a menu in-line with some options.  This is used in areas like the application list, where if you tap and hold an application you get the option to pin it to the start menu, uninstall, etc.  For the toolkit control this is implemented as a ContextMenu service.  For example, if I wanted to enable a context menu on my canvas I would use this markup:

   1: <Canvas HorizontalAlignment="Left" VerticalAlignment="Top" Width="345" Height="91" Margin="0,50,0,0">
   2:     <toolkit:ContextMenuService.ContextMenu>
   3:         <toolkit:ContextMenu>
   4:             <toolkit:MenuItem Header="pin to start menu" Click="OnMenuClicked" Tag="START_MENU" />
   5:             <toolkit:MenuItem Header="delete" Click="OnMenuClicked" Tag="DELETE" />
   6:             <toolkit:MenuItem Header="share" Click="OnMenuClicked" Tag="SHARE" />
   7:         </toolkit:ContextMenu>
   8:     </toolkit:ContextMenuService.ContextMenu>
   9:     <Rectangle Fill="#FFF4F4F5" Height="91" Stroke="Black" Width="345"/>
  10:     <TextBlock TextWrapping="Wrap" Text="Tap and Hold (zoom)" Foreground="Black" Canvas.Left="71" Canvas.Top="27"/>
  11: </Canvas>

And the result would look like:

ContextMenu control

There is an option to disable ‘zoom’ of the context menu, which follows the UI consistency of the device itself and is the default.  Additionally you could implement the actual command using ICommand on the particular item.

DatePicker and TimePicker

These are two controls I’ve seen attempted to create to mimic the actual device controls in the WP7 OS itself.  Some implementations have been better than others.  Here the UI is matched with the semantics of the device.  When using the control, it will automatically provide you with a TextBox input and when the user selects it, the picker will display.  The markup is very simple:

   1: <toolkit:DatePicker />

to produce the user experience when the user clicks on the input area:

WP7 Toolkit pickers

While shown above is the DatePicker, the TimePicker operates in similar fashion.

For the pickers you may notice that in my screenshot above I have the checkmark and the “x” icons in the ApplicationBar.  If you didn’t read the code comments in the toolkit you likely have “x” icon placeholders and are wondering why.  The toolkit provides the necessary icons for these, but you have to bring them into your application.  Once installed, look for them in the SDK folder and then add them using this well-known path:

WP7 toolkit icon layout

Once you have the PNG files there, be sure to mark them as Content so they are included correctly and then you should be good!


If you notice areas in WP7 that have simple on/off settings you may want to provide a consistent look in your application.  The ToggleSwitch control does just that, providing not only the actual ToggleButton, but also the area for label/etc.  This area could be templated as well so if you needed more than just a single text heading listing.  The code:

   1: <toolkit:ToggleSwitch Header="my setting name" Height="118" Margin="0,0,-24,-34" Width="480"/>

and the resulting UI:

ToggleSwitch control


Wish you had a library that made it easier to know when a ‘flick’ or ‘pinch’ gesture happened?  Enter GestureHelper.  Using this on elements like this:

   1: <Image x:Name="GesturedImage" Source="dividbyzero.jpg" HorizontalAlignment="Center" VerticalAlignment="Center" Width="450" 
   2:     RenderTransformOrigin="0.5,0.5">
   3:     <Image.RenderTransform>
   4:         <ScaleTransform x:Name="ImageScaling" ScaleX="1" ScaleY="1" />
   5:     </Image.RenderTransform>
   6:     <toolkit:GestureService.GestureListener>
   7:         <toolkit:GestureListener PinchDelta="OnPinchDelta" />
   8:     </toolkit:GestureService.GestureListener>
   9: </Image>

enables you to respond to these events when they happen and react accordingly:

   1: private void OnPinchDelta(object sender, PinchGestureEventArgs e)
   2: {
   3:     ImageScaling.ScaleX = e.DistanceRatio;
   4:     ImageScaling.ScaleY = e.DistanceRatio;
   5: }

Very helpful library!!  NOTE: the above sample is actually not goot ‘pinch’ scaling for an image, but merely here to demonstrate a quick point.


The WrapPanel has been specifically ported for WP7.  Using the similar syntax:

   1: <toolkit:WrapPanel Orientation="Horizontal">
   2:     <Rectangle Fill="Blue" Width="100" Height="100" Stroke="Black" />
   3:     <Rectangle Fill="Red" Width="100" Height="100" Stroke="Black" />
   4:     <Rectangle Fill="Green" Width="100" Height="100" Stroke="Black" />
   5:     <Rectangle Fill="Gray" Width="100" Height="100" Stroke="Black" />
   6:     <Rectangle Fill="Yellow" Width="100" Height="100" Stroke="Black" />
   7:     <Rectangle Fill="Orange" Width="100" Height="100" Stroke="Black" />
   8:     <Rectangle Fill="Teal" Width="100" Height="100" Stroke="Black" />
   9:     <Rectangle Fill="White" Width="100" Height="100" Stroke="Black" />
  10:     <Rectangle Fill="Pink" Width="100" Height="100" Stroke="Black" />
  11:     <Rectangle Fill="Magenta" Width="100" Height="100" Stroke="Black" />
  12: </toolkit:WrapPanel>

would produce the elements within the WrapPanel to be placed accordingly for you:

WP7 Toolkit WrapPanel

This will be helpful especially in areas of displaying items in storage locations (i.e., pictures, album art) I think.


These controls are being made available for you to freely consume in your applications.  Go to the Silverlight Toolkit site right now and download the Silverlight for Windows Phone Toolkit and begin incorporating them into your applications today.  Be sure to leave feedback on the Codeplex site with any issues you may find with your scenarios.

Be sure to visit the Silverlight Toolkit site for the bits and also ensure you subscribe to Jeff Wilcox and David Anson’s blogs for what likely will follow more detailed and useful information about the toolkit items!

Hope this helps!

| Comments

After a longer-than-should-have-been delay (you can blame me for that) allow me to introduce JetPack.

JetPack theme

I’m really excited about this theme and the work that our team put together here.  You may have see Tsitsi talk about theming in general and introduce this theme on Silverlight TV.  The challenge behind this theme was to take some of the excitement around other Silverlight themes and create a great looking overall theme that could be used for line-of-business applications, but also extended as desired by any other application.

Working with the team at Pixel Lab, our small team looked at areas of inspiration from various online and client applications that are popular and what worked well about the user interaction on those themes.  Robby and team did a great job in my opinion of creating a very well designed theme that can be used in almost any circumstance.

During this September refresh of the themes we’ve also updated the previous 3 themes: Cosmopolitan, Windows and Accent Color with some minor fixes and tweaks based on some feedback we got.  You can see a preview of the various styles in JetPack here.

We hope you enjoy JetPack as much as we do!  We’ve provided the theme pack in the same way as we have the others, as templates for Visual Studio 2010 and Expression Blend 4 and the raw assets (resource dictionaries) for you to download.  Each Visual Studio template is build for modeling the Silverlight Navigation Application template and the WCF Ria Services Business Application template.  We’ve provided the VSIX installer formats so you just need to download that, double-click and you’ll have them in your File…New Project window for selection.

Thanks for your patience through the release of JetPack, there were some moving parts in the end (mostly delays in our release management system which underwent some changes) that were human-caused [blame me] but we’re glad to finally get it out in the wild!  Download all the themes here.

Hope this helps!

| Comments

SilverlightShow.net is one of those great community sites providing information, tutorials and general developer information around Silverlight.  They’ve done a great job providing a spectrum of beginner to advanced topics on Silverlight development. 

At MIX10 I was talking with one of the brains behind the site (and Silverlight MVP), Emil Stoychev, one one of the ways they had been displaying book recommendations on their site.  It was a bookshelf view that I thought was cool and I wanted to use it for my own book recommendation list on my blog. 

NOTE: It was funny in talking with Emil because they had this bookshelf control for a while and then the iBooks app for iPhone/iPad came out and looked really familiar.  Of course, the user experience isn’t something entirely new for displaying this type of information, but it was cool to see consistency.

I asked Emil if I could use the control and showcase some of the work they do on that site.  They carved off a little area where I could manage my books and here it is:

SilverlightShow bookshelf

You can see it running live and interact with it on my Silverlight Book Recommendations link here on this site.  I think it is a lot better than just a standard list of links.  Now I just need to fill up the shelves so they don’t look so empty!

Thanks Emil and SilverlightShow! And to answer in advance, I’m not sure if they plan on releasing this as a sample control or what…that is something you’ll have to head over to their site and ask them (and check out their material as well).