partial void OnXXXXXXChanged(string value) in viewmodel error #528
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
This is my viewModelnamespace Alina.ViewModel
{
[INotifyPropertyChanged]
public partial class BindingClassToolkitViewModel
{
public BindingClassToolkitViewModel()
{
}
public ArticoloModel ArticoloModel { get; set; } = new ArticoloModel();
[RelayCommand]
public async Task AddArticolo()
{
// Add to database !
ArticoloModel.ClearFields();
}
// HERE I HAVE THE ERROR
// Alla pressione di ogni tasto scatta l'evento.
// esiste un evento per ogni pubblica variabile: OnXxxxxChanged
partial void OnCodiceChanged(string value)
{
App.Current.MainPage.DisplayAlert("Changed", value, "OK");
}
}
} |
Beta Was this translation helpful? Give feedback.
-
My view |
Beta Was this translation helpful? Give feedback.
-
my modelusing CommunityToolkit.Mvvm.ComponentModel; namespace Alina.Model { } |
Beta Was this translation helpful? Give feedback.
-
|
Ciao! The issue is that you simply don't have a generated "Codice" property there. The partial "On___Changed" methods are generated for properties you declare via Also, just a side note: avoid using |
Beta Was this translation helpful? Give feedback.

Ciao! The issue is that you simply don't have a generated "Codice" property there. The partial "On___Changed" methods are generated for properties you declare via
[ObservableProperty], and you don't have such a property inBindingClassToolkitViewModel(you have one inArticoloModel).Also, just a side note: avoid using
[INotifyPropertyChanged]if you can inherit from[ObservableObject]instead.