0

我有 mainpage.xaml 我创建的事件为

Public Event ValueChanged()

我将下拉 selectedindexchanged 事件上的事件提升为

Private Sub ComboBox1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Handles ComboBox1.SelectionChanged
    RaiseEvent ValueChanged()
End Sub

我需要在 test.xaml 页面中访问此事件,我需要如何调用该事件..

4

1 回答 1

0

使用构造函数将 MainPage 实例的引用传递给您的 TestPage

Public Sub New(mainPage As MainPage){
   // store reference and register event;
}

或向您的 TestPage 添加一个属性以设置对 MainPage 的引用

Public Property MainPage() As MainPage
    Get
        Return m_MainPage
    End Get
    Set
        m_MainPage = Value
            // register event of MainPage
    End Set
End Property
Private m_MainPage As MainPage
于 2013-07-16T07:36:49.477 回答