Using Grids with ItemsControl in XAML

ItemsControl in XAML is a useful control that allows you to bind against multiple items and have them displayed using a repeating template (or templates). It forms the basis of the ListBox and other controls but can be used on its own where extra behaviour such as selection is not needed.

By default the ItemsControl uses a vertically aligned StackPanel as the layout panel for its items but you can override this by providing a template. It’s quite common to override this for example to use a VirtualizingStackPanel but in this instance I wanted to use a Grid for layout.

Dynamic SQL scripting on Windows Phone 7 with LINQ

I recently had cause to look into running dynamic SQL on WP7 for a customer. On a desktop this is easy, you just run some SQL statements through ADO.NET and you’re sorted. On Windows Phone 7 it’s a little trickier. This is because WP7 only exposes LINQ to SQL and it doesn’t support arbitrary SQL execution against your SQL CE databases.

So how to handle it when you have a corrupt DB and want to send a fix to a remote device or you just want to update the DB with some new data.

Connecting to SharePoint on Office 365 with Windows Phone 7

One of my colleagues recently asked me to look into connecting to a SharePoint site running on Office 365 from a Windows Phone 7 application. Now this is something that the phone has native support for but in this case he wanted to be able to build an application that had added functionality and then called into the SharePoint web service APIs to extract data from SharePoint.

Simulated Push Notifications on Windows Phone 7

I’m currently prepping for my TechEd Europe WP7 session and I like to prepare for the worst. My demo relies on some cloud services and also on WP7 push notifications. Push notifications are nice but they have one drawback for demos, I need an internet connection.

Now in the real world my application would indeed need an internet connection or it would actually be kind of useless, but in demoland I don’t need one as I can run the cloud services portion in the Azure DevFabric which is nice in case the internet connectivity in the demo room goes down, I have a backup.

The same isn’t true of push notifications, they are managed by Microsoft and if I can’t get to them I can run my demo even though my own cloud services are running locally. In order to get around this I wrote a simple WCF service that also runs in my Azure DevFabric along with my other services that can act as a push notification endpoint. It’s not totally seamless but it works quite nicely for me as I now have a fallback for push notifications as well as for my own cloud services.