Windows Phone 7, adding and displaying icons.

Hi all, I tried to display an icon in my Windows Phone 7 application: <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/" Text="Settings" /> By default, when you add an image to the solution folder it sets the build action as Resource, as shown below: But when you run the application with the Build Action as Resource you will get […]

Silverlight 4 debugging and Firefox 3.6.4+

I’ve been stuck on this for a few days. At the moment, Firefox 3.6.4 (and newer) have a new functionality called ‘Crash protection’, which is quite nice. For customers. … It now runs the plugins in a separate process called ‘plugin-container.exe’ (look in your task manager). But for developers it’s quite the hassle, since Visual […]

Property setters and side effects

I ran into this little problem last week. I had a class with some properties and they were implemented like this: class Foo { private int _bar; public int Bar { get { return this._bar; } set { this._bar = value; this.DoSomeThing(); } } private void DoSomeThing() { /* blah */ } } Setting the […]

Dispose and Finalizing, done the right way

I created this class to make life a little bit easier for me. You are free to use it as you wish! How to use: Override this class, override ReleaseManaged() and ReleaseUnmanaged() with the appropriate code, and you are good to go. namespace SuperDisposeImplementation { using System; /// <summary> /// Override this class for easy […]

VB.NET, why I don’t like it

A little introduction: I’m working on some legacy VB.NET & Excel project. Pretty old stuff, quite the challenge of getting through the code. I’ve discovered multiple things about VB.NET which I didn’t knew (like the Microsoft.VisualBasic namespace, late binding, Option Strict). The code I’m working with is cluttered with these kinds of abominations to the […]

Multi-Column ListView

Ever wanted to have a multi column ListView in WPF? It’s not that hard once you get to know WPF. We take a ListView and set the ItemsPanel to UniformGrid: <Window x:Class="ColumnTest.MainWindow" xmlns="" xmlns:x="" Title="MainWindow" Height="350" Width="525"> <ListView x:Name="MyList"> <ListView.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="3" /> </ItemsPanelTemplate> </ListView.ItemsPanel> <ListView.ItemTemplate> <DataTemplate> <Label Content="{Binding}" /> </DataTemplate> </ListView.ItemTemplate> </ListView> </Window> […]

Windows Azure SDK: connecting to non SQLExpress Instance

When you want to build an Azure application, but you don’t have SQL Express installed the build action in Visual Studio will fail. You will receive the following message in your output window: Windows Azure Tools: Failed to initialize the Development Storage service. Unable to start Development Storage. Failed to start Development Storage: the SQL […]

SqlConnection, Close and deconstructor: Internal .Net Framework Data Provider error 1.

Today I experienced the following issue: I had a class where I would open a SqlConnection, do some actions, and then in the deconstructor I closed the SqlConnection. ~Dumper() { this._sqlConnection.Close(); } Unfortunately every time my program ran it stopped with this error: (click to enlarge) Well it seems that you cannot close a SqlConnection […]

.NET 3.5 pager, generate pages from List<T>

A friend of mine asked me to generate pages from a List<T>. This is my implementation: using System; using System.Collections.Generic; using System.Linq; namespace Pager { static class Program { static void Main() { List<int> list = new List<int>(); //add 26 items for (int x = 0; x < 26; x++) { list.Add(x); } //generate pages […]