2013-08-31 38 views
0

我在母版页(mainpage)一些按钮和我使用它在其他页面时点击通过map像:如何访问e.handled中的silverlight按钮?

MainPage mp = (MainPage)(((BusinessApplication8.Controls.BusyIndicator)Application.Current.RootVisual).Content); 

它正在运行一个以上的,我不能使用e.Handdled以防止它们。 我该怎么做才能控制它?

例如,我们希望我们的代码里面以下事件(ListPish_Emza_Click)每次点击只运行一次:

void ListPish_Emza_Click(object sender, RoutedEventArgs e) 
{ 

    if (sender == e.OriginalSource) 
     return; 
    Approve_Click(sender, e); 

} 

但上面的代码运行每次点击不止一个。

回答

0

不推荐手动触发事件。

我无法实现您的应用程序体系结构。但是,你应该把你的代码放在静态类的方法中并使用它。

+0

谢谢,有什么办法自动发射一个事件?你能举个例子吗? –

+0

你为什么写这个代码? MainPage mp =(MainPage)(((BusinessApplication8.Controls.BusyIndi​​cator)Application.Current.RootVisual).Content); –