Reputation: 21
I'm trying to show changing values on MainPage, but it doesn't update the values, unless i change something in the xaml.
In the mainViewModel i've got a double, which i'm changing on a loop.
public partial class MainViewModel : ObservableObject
{
[ObservableProperty]
private double price;
..
[RelayCommand]
void count()
{
price++; // <- This is field price and not the property Price
}
in the MainPage.xaml, i have a label i'd like to change
<Label Text="{Binding Price, StringFormat='Price: = {0:F2}'}"/>
I tought [NotifyPropertyChangedRecipients] might help, but it gives me an error MVVMTK0022.
Upvotes: 1
Views: 1442
Reputation: 21
Idk how to mark it as answer, but Jason pointed at the problem: "Most likely you are updating the field price and not the property Price."
Upvotes: 1