【问题标题】:How can I access to e.handled for a button in silverlight?如何访问 e.handled 以获取 silverlight 中的按钮?
【发布时间】:2013-09-03 21:30:11
【问题描述】:

我在母版页 (mainpage) 中有一些按钮,我使用 map 在其他页面中的事件点击,例如:

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

它正在运行多个,我不能使用e.Handdled 来阻止它们。 我该怎么做才能控制它?

例如,我们希望我们的代码在下面的 event(ListPish_Emza_Click) 中每次点击只运行一次:

void ListPish_Emza_Click(object sender, RoutedEventArgs e)
{

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

}

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

【问题讨论】:

    标签: c# silverlight code-behind


    【解决方案1】:

    不推荐手动触发事件。

    我无法理解您的应用程序架构。但是,您应该将代码放在静态类的方法中并使用它。

    【讨论】:

    • 谢谢,有没有办法自动触发事件?你能举个例子吗?
    • 为什么要写这段代码? MainPage mp = (MainPage)(((BusinessApplication8.Controls.BusyIndi​​cator)Application.Current.RootVisual).Content);
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-10
    • 1970-01-01
    相关资源
    最近更新 更多