自定义RoutedEvent作为EventTrigger

我有自己的形状类

public sealed class MirrorTile : Shape 

在这堂课中,我添加了这个活动

 public static readonly RoutedEvent SelectedEnterEvent = EventManager.RegisterRoutedEvent("SelectedEnter", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MirrorTile)); public event RoutedEventHandler SelectedEnter { add { this.AddHandler(SelectedEnterEvent, value); } remove { this.RemoveHandler(SelectedEnterEvent, value); } } 

并希望以这种方式使用它

        

在starup之后我得到了exception: {"RoutedEventConverter cannot convert from System.String."}

我做错了什么,我该如何解决这个问题?

命名空间也丢失了。

您还必须提供类型:

  

编辑评论:

您是否尝试过为XAML声明添加命名空间?

  xmlns:local="clr-namespace:YourNameSpace" 

然后修复此问题:

   

我认为您缺少定义事件的类型: