如何在Silverlight 2中创建路由事件?

时间:2022-05-09 06:12:17

Anyone know how to create a routed event in Silverlight 2? In WPF, the code would be like below. However, there’s no EventManager in Silverlight.

任何人都知道如何在Silverlight 2中创建路由事件?在WPF中,代码如下所示。但是,Silverlight中没有EventManager。

    public static readonly RoutedEvent ShowVideoEvent =
        EventManager.RegisterRoutedEvent("ShowVideo", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(NavBar));

    public event RoutedEventHandler ShowVideo
    {
        add { AddHandler(ShowVideoEvent, value); }
        remove { RemoveHandler(ShowVideoEvent, value); }
    }

1 个解决方案

#1


1  

At least for the time being, there doesn't seem to be a way to create your own. That post was however for Beta2, looking at the document for Beta2->RC0 breaking changes, there doesn't seem to be any mention of anything. But then I guess it could be no breaking change, we can always hope eh ;)

至少在目前,似乎没有办法创建自己的。然而,这篇文章是针对Beta2的,看看Beta2-> RC0突破变化的文档,似乎没有任何提及。但后来我想这可能不会有变化,我们总能希望呃;)

There are a number of events which are routed but again I'm not sure this documentation has been updated for RC0.

有许多事件被路由但是我不确定此文档是否已针对RC0进行了更新。

#1


1  

At least for the time being, there doesn't seem to be a way to create your own. That post was however for Beta2, looking at the document for Beta2->RC0 breaking changes, there doesn't seem to be any mention of anything. But then I guess it could be no breaking change, we can always hope eh ;)

至少在目前,似乎没有办法创建自己的。然而,这篇文章是针对Beta2的,看看Beta2-> RC0突破变化的文档,似乎没有任何提及。但后来我想这可能不会有变化,我们总能希望呃;)

There are a number of events which are routed but again I'm not sure this documentation has been updated for RC0.

有许多事件被路由但是我不确定此文档是否已针对RC0进行了更新。