routed event SL4

Aug 4, 2011 at 2:29 PM

HI,

I am using Silverlight 4 and very new to this , i had done routed events in wpf

which was

#Region "Events"

    Public Shared ReadOnly MenuEnableRoutedEvent As RoutedEvent = EventManager.RegisterRoutedEvent("MenuEnable", RoutingStrategy.Bubble, GetType(RoutedEventHandler), GetType(UserControlBase))

    Public Custom Event MenuEnable As RoutedEventHandler

        AddHandler(ByVal value As RoutedEventHandler)
            Me.AddHandler(UserControlBase.MenuEnableRoutedEvent, value)
        End AddHandler

        RemoveHandler(ByVal value As RoutedEventHandler)
            Me.RemoveHandler(UserControlBase.MenuEnableRoutedEvent, value)
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
            Me.RaiseEvent(e)
        End RaiseEvent
    End Event

 

# End Region

#Region "Methods"

    Protected Overridable Sub RaiseEvent_MenuEnable()

        RaiseEvent MenuEnable(Me, New RoutedEventArgs(MenuEnableRoutedEvent, Me))

    End Sub

# End Region

 

then on main form

 

 InitializeComponent()

        EventManager.RegisterClassHandler(GetType(UserControlBase), UserControlBase.MenuEnableRoutedEvent, New RoutedEventHandler(AddressOf MenuEnableHandler))

 

 Private Sub MenuEnableHandler(ByVal sender As Object, ByVal e As RoutedEventArgs)


        Try

            TreeView1.IsEnabled = True
            cmbTaxYear.IsEnabled = True
            txtblkWSMessage.IsEnabled = True
            'tlbCustomToolBar.IsEnabled = True

            txtblkWSMessage.Foreground = Brushes.Red

        Catch ex As Exception

        End Try
    End Sub

 

An then from my other forms(usercontrol) i used to call

MyBase.RaiseEvent_MenuDisable()

 

how do i make a call in silverlight user control using the code provided in  codeplex example. any idea /suggestions please