I found a better approach, one that isn’t as scary

builder.Define(
    mEntryColumn,
    aEditor,
    (column, editor) => column.AddNumericField(editor.Format)
                            .BoundTo(editor, e => e.Value)
                            .FocusBoundTo(editor, e => e.Focused));

The key difference is one of approach - instead of trying to subscribe to an arbitrary event (which is difficult since you can’t pass events around as data, only delegates), I went with subscribing to an arbitrary property and keeping the gnarly bits under the covers.

Comments

blog comments powered by Disqus
Next Post
Stages of Competence  22 Mar 2009
Prior Post
Scary Code  18 Mar 2009
Related Posts
Browsers and WSL  31 Mar 2024
Factory methods and functions  05 Mar 2023
Using Constructors  27 Feb 2023
An Inconvenient API  18 Feb 2023
Method Archetypes  11 Sep 2022
A bash puzzle, solved  02 Jul 2022
A bash puzzle  25 Jun 2022
Improve your troubleshooting by aggregating errors  11 Jun 2022
Improve your troubleshooting by wrapping errors  28 May 2022
Keep your promises  14 May 2022
Archives
March 2009
2009