I just wrote this code:

builder.Define(
    mEntryColumn,
    aEditor,
    (column, editor) => column.AddNumericField(editor.Format)
                            .BoundTo(editor, e => e.Value)
                            .FocusWhen<ResponseEditor, EventArgs>(
                                editor, 
                                (e, handler) => e.Focussed += handler));

FocusWhen() is designed to hook up a UI Control (just created by the call to AddNumericField()) with a domain object (aEditor) so that aEditor can make the control focused.

It works. But it sure as gravy ain’t pretty.

I think it fails the WTFs/m metric.

I needs me a better way!

Comments

blog comments powered by Disqus
Next Post
Unscary Code  19 Mar 2009
Prior Post
Real World Information Modelling: Naming  15 Mar 2009
Related Posts
Contract for Online Access  10 Jan 2014
A story about Magic  10 Dec 2011
Windows Phone 7 vs Z88  27 Sep 2011
Lessons learnt at TechEd  06 Sep 2011
StackOverflow and Clay Shirky  03 Dec 2010
Thanks to the Palmy .NET User Group  16 Nov 2010
Gadget Envy  15 May 2010
A Regular Expression Bug  14 Dec 2009
Google's new Language  13 Nov 2009
TechEd New Zealand 2009  19 Sep 2009
More random posts »
Archives
March 2009
2009