 |
|
 |
|
|
Author: |
David Hanson |
Created: |
Wed, 02 Jan 2008 20:28:49 GMT |
 |
|
All things .net, wpf, XAML, C#, Workflow Foundation and many more. |
|
WPF: Extending the Page & UserControl base classes |
|
|
By David Hanson on
Mon, 25 Feb 2008 22:50:15 GMT
|
|
|
When working with different .NET technologies it is often good practice to extend a number of bases classes for your own requirements. There are couple of benefits for doing this.
- The derived classes provide a layer of protection/abstraction from the core framework so that changes can be managed more effectively.
- The derived classes provide the ability for you to extend base behaviour and share that throughout your application.
- You can increase testability.
Generally, when starting a new development, I like to do some of this infrastructure work upfront, this saves me a lot of refactoring down the line when I realise I need to extend a base class. Following this approach is particularly useful when working with .NET UI technologies such as WinForms, ASP.NET and WPF which implement a number of base classes upon which the majority of UI components are based.
Below is an example of the standard WinForms model whereby each Form is derived from System.Windows.Forms.Form versus the model I implement when I intend to extend the base Form class.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Extended.Base.Example
{
public class FormEx: Form
{
}
Our StandardForm implementation
using System;
|
|
Comments (0)
|
More...
|
|
|
WPF Ribbonbar and more coming in 2008! |
|
|
By David Hanson on
Thu, 21 Feb 2008 12:32:42 GMT
|
|
|
|
Scott Gu has shed some light on some of the changes coming to WPF this year. Notably, Scott inidcates that there will be new contols for WPF, one of which is a new a "Ribbon" control. I have thought that for a while that Microsoft needed to get this control to market as the Office 2007 styling has become quite popular.
There are a number of vendors that do offer a WPF ribbon these are shown below.
Also it seems more graphic intensive features such as shadowing etc are being pushed onto the graphics hardware increasing performance. V.cool!
|
 |
|
Comments (0)
|
|
|
|
Silverlight 2.0! Cant wait! |
|
|
By David Hanson on
Mon, 18 Feb 2008 13:44:39 GMT
|
|
|
|
I have just finished listening to Scott Gu's comments on Silverlight 2.0. From what he is saying 2.0 should finally offer the level of functionality to truly make Silverlight a compelling option.
Just to summarise....Silverlight 2.0 will get the following.
- Large suite of controls for developing LOB style applications
- Databinding support
- Styling and control templating
- Flowlayout support
- WCF Communications stack support
Good news!
|
 |
|
Comments (0)
|
|
|
|
Alt.NET Seattle |
|
|
By David Hanson on
Fri, 15 Feb 2008 10:24:49 GMT
|
|
|
|
Having attended the Alt.net UK conference a few weeks ago I am disappointed by the fact that I cannot make the US event. There's going to be some great people there and the chance to discuss topics with them would have been great.
I am making sense of my decision using the following. 
- Its expensive to head over to the US just for a conference.
- I am getting married this year and need to save some money.
- The "Mrs" gets jealous and thinks its a holiday.
- There will be other events.
With that I rest my case.
|
 |
|
Comments (0)
|
|
|
|
Random muttering: Visualising Test Coverage |
|
|
By David Hanson on
Mon, 18 Feb 2008 19:56:16 GMT
|
|
|
Ok, this one will is going to sound a little odd but bare with me. The other day I received a call from a friend who I used to work with. He’s now moved on to a new company and is responsible for managing a team of developers who have been focused on developing internal systems.
Upon starting with the company, the IT director had expressed his concerns that the development teams were generally gun ho about configuration management and that on many occasions critical systems had been down for extended periods. Basically, my friends role is to get a grip with these kind of issues and improve the overall quality and professionalism of the team.
He told me that the systems had been written in .net 1.1 and very little progress had been in terms of migrating them to 2.0 and definately no 3.5. Another key issue he had identified was that the application had absolutely no code coverage and therefore developers were unaware of what impact their changes could have to the behaviour of the applications. I think more to the point, as we discussed the environment, it became apparent that the majority of developers had very little understanding TDD and the benefits it can bring to your project.
Given the environment, my friend and I discussed a number of options that he could take forward in terms of educating the team in the ways of TDD and primarily some way of obtaining some level of test coverage of the application code. It was the later thread that sparked an interesting conversation about conceptualising a test and how you can get increase coverage from a small number of tests. He had explained that the architecture was fairly standard with a complex model that uses fine-grained interfaces for business entities wrapped up with a coarse-grained interface that is exposed to the UI.

Discussing the split between UI code and service/business code it seemed there was approximately 30/70 split. Therefore, we both felt the best place to start would be at the service contract layer. The service contract provides a single point of access into a complex system. This is a very key point, what it essentially means is that by using the service contract and multiple data scenarios we can cover large portions of code within the complex model. To help developers visualise this concept, we talked through a few analogies that would fit. Below are 3 visualisations of this.

Lightning Forks

Ants nest paths

Tree root system
As you can see, each of these images can be used to visualise the many branches of code that could possibly be taken from the top down entry point. Exploring these different paths takes a multitude of data scenarios. Each data scenario being passed into the top level entry point results in decisions being made on that data at each ...
|
 |
|
Comments (0)
|
More...
|
|
|
Visual Studio Xmas tree settings |
|
|
By David Hanson on
Fri, 08 Feb 2008 15:55:53 GMT
|
|
|
|
Most developers spend the majority of their day with their head stuck inside visual studio, I’m no different, so as a result I like to customize my editor so that I am as comfortable as possible. Its in this area i’m a little old fashioned. I can’t stand the default white colour settings that visual studio offers, therefore I spend quite some time tuning them so they meet my needs. Below is an example my code windows in visual studio. I really like these settings and I feel it makes the code far more readable and items such as strings, numbers, operators, keywords and regions are all specifically coded.

Many of my colleagues have commented that my settings make my code window look like a Christmas tree. So if your feeling like you want to be a little festive then you can grab them here.
|
 |
|
Comments (0)
|
|
|
|
Alt.Net UK Conference |
|
|
By David Hanson on
Thu, 07 Feb 2008 10:57:52 GMT
|
|
|
|
As some of you may know..... and some may not, I have been working with Conchango on a project for the last 9 months. The conchango guys are great to work with, so when they asked if I wanted to attend the Alt.Net conference this weekend (as they were hosting it), I was chuffed as originally I had thought I had missed the registrations.
The conference was broken up over two days. Friday was a meet and greet session in the evening, everyone gets the opportunity to propose a session that they would like covered on the Saturday. I was really impressed with the topics that were up for discussion, my two offerings were "Declarative Programming & Testability" and "Why use ORM".
After filling the whiteboard with post it notes, I was amazed to see just how many where were related to testing and general quality of development. Having defined a rough agenda for the Saturday, everyone headed off to the Bankside bar where we could get to know each other. I couldn't stay too long as getting home takes an hour and half and had been at work all day I was a little shattered.
Over the next week I will be updating you about the sessions I attended and some of the key conclusions I came to. Generally though, I thought the conference was a great success. I got to meet some fantastic people and validate my ideas against others... oh and play a little table football. Many thanks must go to Ian Cooper, Alan Dean and Ben Hall for great organisation.
|
 |
|
Comments (0)
|
|
|
|
Visual Studio Ribbon Bar |
|
|
By David Hanson on
Thu, 07 Feb 2008 10:56:59 GMT
|
|
|
|
Last night I awoke around 3am in a state of panic. What you ask could be making me worry? The answer is simple.....
Visual Studio implementing the Ribbon Bar 

Lucky for me it was just a dream..........it was wasn't it?
|
 |
|
Comments (0)
|
|
|
|
Is BizTalk as a product dead? |
|
|
By David Hanson on
Fri, 08 Feb 2008 15:51:18 GMT
|
|
|
|
Last weekend I was at a wedding fair with my fiancée looking at the last remaining big things we need to get sorted for our wedding in August. While there, I ran into my brother in-law (to be) who is also getting married. As he works at my old company we naturally ended up talking shop. During this time the girls were browsed for fairy dust or something. (I think it’s fair to say we aren't really there by choice. :-))
So during our discussion he told me about his boss asking him to get some Microsoft certs and he had a choice between BizTalk and SharePoint. At the time I said get the SharePoint certs as they are far more likely to get you a job in the future as SharePoint is generally more popular in the enterprise. After that I moved on and forgot about things.... until today.
As I was going for a walk during my lunch time I started to think about Microsoft’s current strategy for BizTalk and how there seems to be this awkward situation now that windows workflow has arrived. Having worked with both WF and BizTalk it is clear where the difference are between the products. I have listed these below.
1.) BizTalk is the enterprise solution and can scale (albeit costly), workflow is not currently seen this way.
2.) BizTalk comes with a set of adaptors/accelerators for EAI, workflow has WCF, but custom formats such as EDI are not backed in.
3.) BizTalk provides sophisticated BAM. Some work has been carried out to allow Workflows to integrate with BizTalk’s BAM but this can be considered just an integration point with BizTalk.
4.) BizTalk comes with productivity tool like the mapper. XSLT is still a rare skill and the mapper is not available for WF.
5.) BizTalk has a sophisticated rules engine. Workflow does not.
6.) BizTalk comes with Health and Activity monitoring.
Although there are many additional enterprise features that BizTalk has offer over WF, there is one issue and that needs to be addressed. That is, that Microsoft now has two retail workflow/orchestration engines.
Having two workflow engine technologies is just not right, and Microsoft has recognised that. As a result WF is due to be integrated into future versions of the BizTalk product. However doing so raises a number of questions around the value of BizTalk as a product on its own right. If WF provides the core orchestrations (which is really the selling point of BizTalk) then surely the other features of BizTalk are just extension to WF?
Sample design surface for WF below< ...
|
 |
|
Comments (2)
|
More...
|
|
|
70-502, 70-503, 70-54 Microsoft .net 3.5 Certification |
|
|
By David Hanson on
Thu, 07 Feb 2008 10:56:15 GMT
|
|
|
|
So last year I updated my MCSD to the .net 2.0 certifications that included features such as generics etc. I left that update a little late in the day as I had not really had a need to update them and they felt like small extensions to the 1.1 certs I had already achieved.
Over the last year and half I have been workign with .NET 3.0 technolgies, 3.0 brings a raft of new technolgies to the developer. The 3 core technolgoy center pieces being WPF, WF and WCF.
As a result I have been eagerly awaiting the .net 3.0 exams in order to keep my certification up to date. It seems however microsoft have decided to skip by 3.0 certs and go straight to 3.5. Either way I'm happy and I will be boooking myself in in the not too distant future.
Exam 70-502 Microsoft .NET Framework 3.5 - Windows Presentation Foundation. Expected to be released in February 2008. http://www.microsoft.com/learning/exams/70-502.mspx
Exam 70-503 Microsoft .NET Framework 3.5 - Windows Communication Foundation. Expected to be released in February 2008. http://www.microsoft.com/learning/exams/70-503.mspx
Exam 70-504 Microsoft .NET Framework 3.5 - Windows Workflow Foundation. Expected to be released in March 2008. http://www.microsoft.com/learning/exams/70-504.mspx
|
 |
|
Comments (0)
|
|
|
|
3.5 .Net Framework Souce Release |
|
|
By David Hanson on
Thu, 07 Feb 2008 10:55:06 GMT
|
|
|
|
Over the weekend I had a play with the new .NET framework source code release which now allows you to debug into framework classes as part of your standard debugging. The source gives a good insight into how classes have been built and can often help in understanding their behaviour. Also it comes with the original comments which can be quite enlightening. You can only do this from visual studio 2008 and most of the .net framework including WPF can be debugged.
Couple of funny comments in the code that I found from initial play below.
Optimistic developer
// Note: This doesn't work on Win9x. We can implement this
// functionality on Win9x by writing a 16 bit DLL and
// calling the LAN Manager method NetWkstaGetInfo(). See
// We don't have the time to implement this in V1. Hopefully
// by the time V2 rolls around, everyone will run Windows XP.
Hacking is part and parcel of the MS Job. J
// HACK HACK HACK - when we change RightToLeft, we need to change the scrollbar thumb.
// We can't do that until after the control has been created, and all the items added
// back. This is because the system control won't know the nMin and nMax of the scroll
// bar until the items are added. So in RightToLeftChanged, we set a flag that indicates
// that we want to set the scroll position. In OnHandleCreated we check this flag,
|
 |
|
Comments (0)
|
More...
|
|
|
WPF text trimming |
|
|
By David Hanson on
Thu, 07 Feb 2008 10:49:52 GMT
|
|
|
|
Here’s a useful tip for you budding WPF aficionados out there. If there is any chance that the text in a textblock may become truncated (the databound text may not fit or the window may be resized), assuming you don’t want the text to wrap (where you would use the TextWrapping attribute), add the TextTrimming attribute. Your options are None (no ellipse – default), WordEllipse (an ellipse is inserted after the last word that fits) or CharacterEllipse (an ellipse is inserted after the last character that fits).
Example from MSDN
<TextBlock
Name="myTextBlock"
Margin="20" Background="LightGoldenrodYellow"
TextTrimming="CharacterEllipse" TextWrapping="NoWrap"
FontSize="14"
>
One<LineBreak/>
two two<LineBreak/>
Three Three Three<LineBreak/>
four four four four<LineBreak/>
Five Five Five Five Five<LineBreak/>
six six six six six six<LineBreak/>
Seven Seven Seven Seven Seven Seven Seven
TextBlock>
Results in
.png)
Hope it helps.
|
 |
|
Comments (3)
|
|
|
|
WPF Bug... ListView within a Listbox |
|
|
By David Hanson on
Thu, 07 Feb 2008 10:49:52 GMT
|
|
|
|
I was recently having issues with a XAML structure I was working on. The stucture of my XAML was as follows.
LISTBOX (Bound to collection of custom objects)
{Item Template}
ListView (Bound to Collection of Child Objects that hangs of the Parent binding)
Now when I ran the app I got the binding firing for each parent and associated child collection but when the xaml renders only the first listboxitem has a listview bound below it. Is this a bug in the way ListViews work when nested within a Listbox's data template?
The answer it turns out is a big YES. Apparently, this is a know issue in WPF. In order to resolve this issue you need to make sure that all your datatemplates are moved to resources. Only then will the databinging and rendering work.
My XAML is show below for reference.
Window x:Class="WpfApplication1.Window1" xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title="Window1" Height="300" Width="300" >
<StackPanel VerticalAlignment="Stretch" >
<Button Click="Button_Click">Run Test</Button>
<ListBox Name="ParentListBox&q ...
|
 |
|
Comments (1)
|
More...
|
|
|
|
|
|
|
|
|
|
|
 |
|
 |
|
Twitter / LordHanson
Published Sun, 29 Aug 2010 05:41:05 +0000
by
Published Sun, 04 Jul 2010 22:07:55 +0000
by
Published Sun, 04 Jul 2010 22:05:28 +0000
by
Published Fri, 25 Jun 2010 23:01:45 +0000
by
Published Fri, 25 Jun 2010 22:54:54 +0000
by
Published Mon, 14 Jun 2010 05:08:43 +0000
by
Published Mon, 14 Jun 2010 00:04:45 +0000
by
Published Sun, 25 Apr 2010 04:39:48 +0000
by
Published Wed, 10 Mar 2010 10:29:19 +0000
by
Published Mon, 22 Feb 2010 12:31:09 +0000
by
Published Thu, 18 Feb 2010 08:13:10 +0000
by
Published Wed, 10 Feb 2010 15:54:37 +0000
by
Published Tue, 09 Feb 2010 13:43:48 +0000
by
Published Thu, 04 Feb 2010 18:09:38 +0000
by
Published Thu, 04 Feb 2010 05:26:39 +0000
by
Published Mon, 01 Feb 2010 09:05:13 +0000
by
Published Fri, 29 Jan 2010 19:07:46 +0000
by
Published Wed, 27 Jan 2010 07:18:07 +0000
by
Published Tue, 26 Jan 2010 19:05:18 +0000
by
Published Tue, 26 Jan 2010 17:48:49 +0000
by
|
|
|
|
|
|
|
|
|
 |
|
 |
|
Silverlight - Google News
Published Fri, 10 Sep 2010 14:32:31 GMT+00:00
by
Published Fri, 10 Sep 2010 05:31:03 GMT+00:00
by
Published Fri, 10 Sep 2010 16:40:17 GMT+00:00
by
Published Tue, 07 Sep 2010 08:40:41 GMT+00:00
by
Published Thu, 09 Sep 2010 12:06:26 GMT+00:00
by
Published Thu, 02 Sep 2010 20:01:56 GMT+00:00
by
Published Thu, 09 Sep 2010 07:42:49 GMT+00:00
by
Published Fri, 10 Sep 2010 10:26:17 GMT+00:00
by
Published Fri, 10 Sep 2010 21:04:42 GMT+00:00
by
Published Wed, 08 Sep 2010 12:23:30 GMT+00:00
by
|
|
|
|
|
|
|
|
|