Saturday, 2 November 2013

Reading Binary Data with the File API and JavaScript

As part of a series of articles I am discussing some of the challenges I faced when trying to build a HTML5 and JavaScript free online icons editor.

Wednesday, 11 September 2013

Building a Pure HTML5 and JavaScript Icons Editor

I've just released my first web based project. It's a pure HTML5 and JavaScript icons editor which I thought, coming from a Windows background, would be a good way for me to learn some of the capabilities and limitations of these technologies. So with that in mind, I decided I would not allow myself any server side code and once the initial page had been loaded every feature had to be implemented without any further calls back to the server.

Wednesday, 14 August 2013

C# WebBrowser Control Proxy Authentication

Setting a proxy server for the WebBrowser control is not a straight forward affair. There are plenty of resources out there on the web that will show you how to do this. However, what is lacking is any solutions that show how to authenticate a proxy server, at least any solutions that would work for me. So in this post I am not only going to show you how to set a proxy for the WebBrowser control, I will also share with you the only solution I know of that successfully authenticates with a proxy.

Friday, 19 July 2013

Building a Colour Picker With HTML5, JavaScript and JQuery

I have recently been teaching myself HTML5 and JavaScript and had an idea for a project in which I would need to use a colour picker. After a little research I soon discovered the new HTML5 input types, one of which is a colour picker. Great! One problem though, although it does work very well in Chrome, it is not supported in Firefox 22 or IE10.

Wednesday, 10 July 2013

C# Dynamic Types

With C# 4.0 we saw the introduction of dynamic types. Objects declared as dynamic are assumed to support any property and method and are therefore not checked by the compiler when you build your solution. If you declare an object as dynamic and attempt to use a property or method not supported by that object a run-time exception will be generated.

Monday, 10 June 2013

Pluralize/Singularize Words with the .NET Framework

You may sometimes come across the need to pluralize or singularize words automatically within your applications. As the English language is a fairly complicated one this is not as straight forward as adding or removing an "S" on the end of a word. There are various different implementation out there that perform with a varying degree of success.

Wednesday, 22 May 2013

Custom Change Tracking Using The Entity Framework

Change tracking is a common feature I find I need to implement in my applications. I like to warn users about the potential loss of data if they cancel without saving changes, and when saving those changes I like to update only those fields in the database that have changed as it's inefficient to update every field.

Monday, 6 May 2013

Interprocess Communication with WCF - Part 2

In Part 1 I showed you how you can use WCF with named pipes to send messages from a client to a server. Now I will show you how we can modify that code to send messages in the other direction, from the server back to the client. We do this by creating a callback interface and referencing it in our service contract. We then implement the callback interface in our client.

Tuesday, 30 April 2013

Interprocess Communication with WCF - Part 1

With the introduction of Microsoft's Windows Communication Foundation from .NET 3.0 onwards we have been provided with a powerful framework for communicating across process boundaries, whether they are on the same machine, the same network or even across the internet. A huge range of configuration options are available for the many scenarios that WCF can be used as part of our solution and they can seem overwhelming to begin with.

Thursday, 18 April 2013

MVVM - Binding to TreeView.SelectedItem

At first, binding to the TreeView's SelectedItem property sounds like a simple task, but if you give it a go you will soon realise it's not so straight forward. That's because the WPF TreeView's SelectedItem property is read-only so we can't set the binding in XAML like normal.

Thursday, 11 April 2013

WPF - Different Data Templates for Different Child Types in a TreeView

The TreeView control in WPF allows us to display hierarchical data and allows us to customise the appearance of this by setting the ItemTemplate property using a HierarchicalDataTemplate, giving us expandable nodes within our tree. However, we can only set the ItemTemplate property once with one data template. Imagine the scenario where you want to display a directory structure. A directory can contain files or other directories which in turn can also contain files or other directories and so on. You might want to use a different data template for files than for directories but as stated earlier you can only set the ItemTemplate property once, so how can we achieve this?

Tuesday, 2 April 2013

CallerMemberName .NET 4.0

After writing my recent post about a basic ViewModelBase implementation, the discussion about the CallerMemberNameAttribute got me thinking... how hard would it be to write my own implementation of this attribute?

Monday, 1 April 2013

MVVM - ViewModelBase

If you are developing a WPF application then you really need to be using the MVVM(Model-View-ViewModel) design pattern. I'm sure the vast majority of prospective employers searching for a WPF developer well expect some familiarity with MVVM. I'm not going to spend hours explaining this design pattern as many people have already done that rather well such as here and here.

Saturday, 30 March 2013

WPF - Find Parent by Type

Building on from my earlier post here I thought I'd show how we can use VisualTreeHelper to go the other way up the tree and find a parent of a specified type.

Thursday, 28 March 2013

WPF - Find Child by Type

WPF provides the VisualTreeHelper class which exposes a few static methods that help us to navigate the visual tree more easily. However, the existing methods don't provide any specific methods for searching the visual tree for a particular element type.