7,655
社区成员
发帖
与我相关
我的任务
分享
public sealed partial class OtherUserControl: UserControl
{
public event System.EventHanlder OnTappedEvent;
public OtherUserControl()
{
}
//假设这里有一个Button的Click事件
private void ButtonClick(object sender,RoutedEventArgs e)
{
//其他处理代码
OnTappedEvent(this,new EventArgs());
}
}
public sealed partial class MainPage: Page
{
public MainPage()
{
OtherUserControl otherUC = new OtherUserControl();
otherUC.OnTappedEvent +=otherUC_OnTappedEvent;
}
void otherUC_OnTappedEvent(object sender, EventArgs e)
{
//这里去响应事件
}
}