Add handler to factory
<p>I can't get this to work.</p>

<p>I need to setup the columns for a datagrid dynamically. One of the columns is a DataGridTemplateColumns with a DoubleUpDown object (from <a href="http://wpftoolkit.codeplex.com/" rel="nofollow noreferrer">this</a> library) </p>

<p>I create the <code>FrameworkElementFactory</code> like this:</p>

<pre><code>FrameworkElementFactory factory3 = new FrameworkElementFactory(typeof(DoubleUpDown));
factory3.SetValue(DoubleUpDown.ValueProperty, binding);
factory3.AddHandler(DoubleUpDown.ValueChangedEvent, new RoutedEventHandler(UnitsChanged));

public void UnitsChanged(object sender, RoutedEventArgs e)
    {
        //do stuff with e.OriginalSource
    }
</code></pre>

<p>This throws an exception of type 'System.Windows.Markup.XamlParseException' when running the application. The problem is in the AddHandler method, if I comment that line it works fine, but obviously I need to attach an event there to do stuff when the value changes. </p>

<p>Can anyone help me, please? Thanks in advance</p>