2011-01-23 63 views

回答

1

你想創建一個事件的我的用戶控件:

public event RoutedPropertyChangedEventHandler MyEvent; 

然而,爲了使其正常工作,你需要創建一個routed event

public static readonly RoutedEvent TapEvent = EventManager.RegisterRoutedEvent(
    "Tap", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyButtonSimple)); 

// Provide CLR accessors for the event 
public event RoutedEventHandler Tap 
{ 
     add { AddHandler(TapEvent, value); } 
     remove { RemoveHandler(TapEvent, value); } 
} 
+0

哦,我似乎很複雜,但謝謝:) – user310291 2011-01-23 19:21:54

相關問題