Reading zip files from Silverlight

Silverlight doesn’t have any classes from the System.IO.Compression namespace, but it’s gone something better, Application.GetResourceStream.  It’s pretty easy to take a stream to a zp file and get a stream to one of the uncomressed files inside it: StreamResourceInfo zipInfo = new StreamResourceInfo(zipStream, null);StreamResourceInfo streamInfo = Application.GetResourceStream(zipInfo, new Uri(fileName, UriKind.Relative));Stream fileStream = streamInfo.Stream; All you…

3

Using the preprocessor to share incompatible XAML between SL and WPF – Part 1

One of the goals of Silverlight is to be a subset of WPF so that you can cross-compile the code between the two frameworks.  This works great when you adhere to the strict subset that Silverlight provides, but when you want to deviate from that to provide richer functionality in your WPF version, you’re left…

7

Piping Converters in WPF and Silverlight

One limitation in WPF and Silverlight is that a Binding can only have one converter.  At least for me, this has meant that I’ve created a lot of very specific converters in my projects.  If I needed a converter to format a string then turn it into a uri, I’d make a class to do…

4

Animating margins in Silverlight

So I ran into a problem the other day where I needed to animate a margin of a control, but Silverlight doesn’t allow for animating Thickness objects (WPF does).  The solution I came up with is very simple and can be used to animate the Margin, Padding, or BorderThickness of any control.  Since Silverlight doesn’t support custom animations,…

7

Introduction

Before we get off to the fun stuff (a.k.a. programming), I think it’s best for me to introduce myself.  I’m a developer at Microsoft working for MSN.  I began programming around age 14, working in QBasic 4.5, and have been addicted ever since.  My language of choice is C#, and I love to play with…