【发布时间】:2025-12-24 08:25:15
【问题描述】:
我有一个自定义事件,并想为其附加一个属性(一个字符串就可以了)。 我需要在我的代码中更改什么:
public static readonly RoutedEvent ModelClickEvent = EventManager.RegisterRoutedEvent(
"ModelClick", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(InfoBox));
// Provide CLR accessors for the event
public event RoutedEventHandler FadeIn
{
add { AddHandler(ModelClickEvent, value); }
remove { RemoveHandler(ModelClickEvent, value); }
}
// This method raises the Tap event
void RaiseTapEvent()
{
RoutedEventArgs newEventArgs = new RoutedEventArgs(InfoBox.FadeInEvent);
RaiseEvent(newEventArgs);
}
【问题讨论】:
标签: c# .net wpf visual-studio