ObservableProperty Binding

master
Yik Teng Hie 3 years ago
parent d3b87a10a3
commit aa2832cb9c

@ -11,6 +11,9 @@
<TextBlock Text="{Binding Title}" />
<Button Content="Add"
Command="{Binding AddCommand}" />
<Button Content="Update"
Command="{Binding UpdateCommand}" />
<TextBlock Text="{Binding Customer}" />
</StackPanel>
</Grid>
</Window>

@ -8,6 +8,9 @@ namespace MvvmCommunityApp.viewmodels
{
public string Title { get; set; }
[ObservableProperty]
private string _customer;
public MainWindowViewModel()
{
Title = "MyIocName";
@ -19,5 +22,11 @@ namespace MvvmCommunityApp.viewmodels
{
Console.WriteLine("Do Add");
}
[RelayCommand]
private void Update()
{
Customer = "New Customer";
}
}
}

Loading…
Cancel
Save