Hi,
I have a ribbon with several commands which enable/disable the state.
But all these elements are ribbonbuttons.
Now I created my own usercontrol where I also want to implement the command so that it can act the same as for example the ribbonbutton.
The next code is implemented in the usercontrol. Until now the command is not fired in the ribbon application. What am i missing/doing wrong here?
I have a ribbon with several commands which enable/disable the state.
But all these elements are ribbonbuttons.
Now I created my own usercontrol where I also want to implement the command so that it can act the same as for example the ribbonbutton.
The next code is implemented in the usercontrol. Until now the command is not fired in the ribbon application. What am i missing/doing wrong here?
Dim MyCommand As Windows.Input.RoutedCommand = Nothing
Public Property Command() As System.Windows.Input.ICommand
Get
On Error Resume Next
Return MyCommand
End Get
Set(ByVal value As System.Windows.Input.ICommand)
On Error Resume Next
MyCommand = value
AddHandler MyCommand.CanExecuteChanged, AddressOf CanExecuteChangedEvent
End Set
End Property
Private Sub CanExecuteChangedEvent(ByVal sender As Object, ByVal e As System.EventArgs)
On Error Resume Next
If MyCommand.CanExecute(Nothing, Me) Then
Me.IsEnabled = True
Else
Me.IsEnabled = False
End If
End Sub