Hi,
there's no problem. Try following demo:
XAML:
<Window x:Class="Window111"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1.WpfApp111"
mc:Ignorable="d"
Title="62241333_220215" Height="450" Width="800">
<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>
<StackPanel>
<Button Content="Change CanLockUnlock" Command="{Binding}" Margin="10"/>
<ToggleButton Content="ToggleButton" IsEnabled="{Binding CanLockUnlock}" Margin="10"/>
</StackPanel>
</Window>
and ViewModel:
Imports System.ComponentModel
Imports System.Runtime.CompilerServices
Namespace WpfApp111
Public Class ViewModel
Implements ICommand, INotifyPropertyChanged
Public Property CanLockUnlock As Boolean = True
Public Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
Public Sub Execute(parameter As Object) Implements ICommand.Execute
CanLockUnlock = Not CanLockUnlock
OnPropertyChanged(NameOf(CanLockUnlock))
End Sub
Public Function CanExecute(parameter As Object) As Boolean Implements ICommand.CanExecute
Return True
End Function
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Private Sub OnPropertyChanged(<CallerMemberName> Optional propName As String = "")
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
End Namespace
Result: