I have the following code
Namespace WpfApplication1
{
using System.ComponentModel;
using System.Runtime.CompilerServices;
using WpfApplication1.Annotations;
using WpfApplication1.Enums;
public class MainWindowViewModel : INotifyPropertyChanged
{
private bool _isItemEnabled;
public MainWindowViewModel()
{
this.IsItemEnabled = false;
}
public event PropertyChangedEventHandler PropertyChanged;
public bool IsItemEnabled
{
get
{
return this._isItemEnabled;
}
set
{
this._isItemEnabled = value;
this.OnPropertyChanged(nameof(this.IsItemEnabled));
}
}
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
<CheckBox Grid.Row="0" Grid.Column="1" Margin="0,20"
IsChecked="{Binding Path = TimeIsEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged }"
DataContext="{Binding ElementName = MainWindowViewModel}">
TestIsEnabled
</CheckBox>
When i am clicking on the checkbox the property TimeIsEnabled located on code behind file doesn`t change and breakpoint on it doesn't fires too. I tried to locate this property at view model but the result was the same. Help please.