field backed properties

This commit is contained in:
ClemensFischer 2025-12-27 22:52:27 +01:00
parent be427c195a
commit c17cbe297f

View file

@ -72,10 +72,6 @@ namespace ProjectionDemo
public class ViewModel : INotifyPropertyChanged
{
private MapProjection currentProjection;
private IMapLayer currentLayer;
private Location pushpinLocation = new();
public event PropertyChangedEventHandler PropertyChanged;
public List<MapProjection> Projections { get; } = [];
@ -84,34 +80,34 @@ namespace ProjectionDemo
public MapProjection CurrentProjection
{
get => currentProjection;
get;
set
{
currentProjection = value;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentProjection)));
}
}
public IMapLayer CurrentLayer
{
get => currentLayer;
get;
set
{
currentLayer = value;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentLayer)));
}
}
public Location PushpinLocation
{
get => pushpinLocation;
get;
set
{
pushpinLocation = value;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PushpinLocation)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PushpinText)));
}
}
} = new();
public string PushpinText
{