i am just getting started with MVVM Foundation. I am getting
my codes below:
StartViewModel
class StartViewModel : ObservableObject
{
public StartViewModel() {
_counter = 0;
}
public ICommand IncrementCommand
{
get { return _incrementCommand ?? (_incrementCommand = new RelayCommand(() => ++Counter)); }
}
protected int Counter {
get { return _counter; }
set {
_counter = value;
base.RaisePropertyChanged("Counter");
}
}
protected int _counter;
protected RelayCommand _incrementCommand;
}
StartView
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="250*" />
</Grid.RowDefinitions>
<Button Content="Increment" Grid.Row="0" Command="{Binding IncrementCommand}" />
<TextBlock Padding="5" Text="{Binding Counter}" Grid.Row="1" />
</Grid>
whats wrong with the code? the error appears when i try click the Increment button