public class MainPageVM : INotifyPropertyChanged
{
ObservableCollection<WifiNetwork> _WifiNetworks;
public ObservableCollection<WifiNetwork> WifiNetworks
{
get
{
return _WifiNetworks;
}
set
{
_WifiNetworks = value;
SetProperty(ref _WifiNetworks, value, "WifiNetworks");
}
}
private WifiNetwork _selectedNetwork;
public WifiNetwork SelectedNetwork
{
get
{
return _selectedNetwork;
}
set
{
_selectedNetwork = value;
SetProperty(ref _selectedNetwork, value, "SelectedNetwork");
}
}
bool isBusy;
public bool IsBusy
{
get { return isBusy; }
set
{
if (isBusy == value)
return;
isBusy = value;
OnPropertyChanged("IsBusy");
}
}
public event PropertyChangedEventHandler PropertyChanged;
public MainPageVM()
{
WifiNetworks = new ObservableCollection<WifiNetwork>();
}
protected bool SetProperty<T>(ref T backingStore, T value,
[CallerMemberName]string propertyName = "",
Action onChanged = null)
{
if (EqualityComparer<T>.Default.Equals(backingStore, value))
return false;
backingStore = value;
onChanged?.Invoke();
OnPropertyChanged(propertyName);
return true;
}
public void OnPropertyChanged([CallerMemberName]string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
Не вижу добавления элементов в коллекцию
Обсуждают сегодня