Posts

Showing posts from January, 2011

Using DeferredLoadListBox in a Pivot Control

Recently I've been using the DeferredLoadListBox It's a fantastic way of improving the performance of your list views.


I started using the DeferredLoadListBox within a Pivot control but occasionally found that the app would randomly crash throwing the following exception: All containers must have a Height set (ex: via ItemContainerStyle), though the heights need not all need to be the same. This usually means you haven't set the properly. However I had ensured I had set the style height. I then got the source and started poking around.


What I found was although in the UnmaskItemContent method the container had a height if you inspected the ActualHeight property this was 0. I did a bit of research and found the following on MSDN: ActualWidth and ActualHeight are calculated based on the Width/Height property values and the layout system. There is no guarantee as to when these values will be "calculated" So the problem appeared to be with timing.


After contacting th…

Windows Phone 7: Security Exception on deactivate

This morning I have been finishing the tombstoning part of one of my Windows Phone applications I have been developing. Whilst testing I found that when the application deactivated or terminated that a SecurityException was thrown. Looking at the stack trace I noticed that it was occurring whilst trying to serialise some data to the Applications State store.


Now I knew I was putting some data into state so this wasn't to hard to find however, when I looked at what I was putting into state it was nothing more complicated than a custom type that exposed a collection of POCO classes. Why would this cause a security exception.


I decided to do a simple Google search for the exception "windows phone 7 security exception" and the second result looked similar: "c# - SecurityException was unhandled when using isolated storage" [http://stackoverflow.com/questions/4209280/securityexception-was-unhandled-when-using-isolated-storage]. So I had a look, and guessed that if you…

Windows Phone Development and Designer Exceptions

I've been building a few Windows Phone applications recently and have been learning lot's along the way and am hopefully releasing a couple of these in the near future. However on my current project I have been constantly hounded by the designer view of my xaml pages throwing exceptions.


Tonight I decided to finally look into why these occur, I have managed to ignore them previously due to the weird nature of them. My exception scenario consists of a page that contains a pivot control and inside one of the pivot items there is a user control. The user control contains a simple list view which has some data bound to itNow I have always got past the exceptions as if you use the designer view for the user control it works fine, however as soon as I put it into a page or a pivot the designer starts kicking off.

The actual exception is as follows: Could not load type 'System.Net.HttpUtility' from assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7…