views:

13

answers:

0

Sometimes when I call RaiseEvent CanExecuteChanged(sender, EventArgs.Empty) from a back ground thread it give me an exception stating "The calling thread cannot access this object because a different thread owns it."

However, if I call System.Windows.Threading.Dispatcher.CurrentDispatcher.CheckAccess is returns True.

What am I doing wrong?

Private Sub m_Parent_PropertyChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs) Handles m_Parent.PropertyChanged
    If System.Windows.Threading.Dispatcher.CurrentDispatcher.CheckAccess Then
        RaiseEvent CanExecuteChanged(sender, EventArgs.Empty)
    Else

    End If
End Sub