I've created the following UserControl:
public partial class ReplacementPatternEditor : UserControl, INotifyPropertyChanged
{
....
public static readonly RoutedEvent CollectionChanged = EventManager.RegisterRoutedEvent(
"CollectionChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ReplacementPatternEditor));
void RaiseCollectionChangedEvent()
{
RoutedEventArgs newEventArgs = new RoutedEventArgs(ReplacementPatternEditor.CollectionChanged);
RaiseEvent(newEventArgs);
}
...
}
Now, when I try to use this routed event inside my xaml code:
<local:ReplacementPatternEditor ItemsSource="{Binding MyItemSource}" CollectionChanged="OnCollectionChanged"/>
I'm getting following error at compilation:
The property 'CollectionChanged' does not exist in XML namespace 'clr-namespace:MyNamespace'
Why am I getting this, and how do I make the routed events work?