Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,366 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello i am trying to make a cart when the user change the numbers of the item ui change but is it not working
here is my code :
public ObservableCollection<ItemsPreview> itemPreview
{
get => _itemPreview;
set
{
_itemPreview = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(_itemPreview)));
}
}
readonly IList<ItemsPreview> source1;
private ObservableCollection<ItemsPreview> _itemPreview;
protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public ICommand increazeNumber { get; set; }
public ICommand DecrazeNumber { get; set; }
public CartViewModel(string UserIp)
{
increazeNumber = new Command<ItemsPreview>(async items =>
{
int NewQuntity = 0;
//check the stock fisrt
NewQuntity = int.Parse(items.Qyt.ToString()) + 1;
items.Qyt = NewQuntity;
});
DecrazeNumber = new Command<ItemsPreview>(async items =>
{
int NewQuntity = 0;
//check the stock fisrt
NewQuntity = int.Parse(items.Qyt.ToString()) - 1;
items.Qyt = NewQuntity;
});
}