I am adding a Custom DataGridTextColumn
that will allow me to fire an event when when ever the content is changed in this cell.
Please note:
I do not want to use a DataGridTemplateColumn
with this as I know that. I want to create my own text column as there are a lot of features that come with text column that we use.
So I decided to just simply add an event to a custom control - simple enough. not so much. well it seams that there isn't an AddHandler
or RemoveHandler
methods.
Please explain where I am going wrong.
Code:
public static readonly RoutedEvent TextChangedEvent =
EventManager.RegisterRoutedEvent("TextChanged", RoutingStrategy.Bubble,
typeof (RoutedEventHandler),
typeof (DataGridTextChangedEventColumn));
public event RoutedEventHandler TextChanged
{
add { AddHandler(TextChangedEvent, value); }
remove { RemoveHandler(TextChangedEvent, value); }
}
private void AddHandler(RoutedEvent textChangedEvent, RoutedEventHandler value)
{
this.TextChanged += (s, e) => textChangedEvent;
}
Thank you.