protected override void ViewIsAppearing(object sender, EventArgs e) { base.ViewIsAppearing(sender, e); if (ProductProperties != null && ProductProperties.Any()) { foreach (var item in ProductProperties) { if (item.PropertyType == PropertyType.IsPicker || item.PropertyType == PropertyType.IsBoolean) { item.PropertyChanged += Handle_PropertyChanged; } } } }
void UnsubscribeToEvents() { if (ProductProperties != null && ProductProperties.Any()) { foreach (var item in ProductProperties) { if (item.PropertyType == PropertyType.IsPicker || item.PropertyType == PropertyType.IsBoolean) { item.PropertyChanged -= Handle_PropertyChanged; } } } if (ProductProperties != null && ProductProperties.Any()) { if (saleOrderLine?.ProductKind == ProductKind.accessory.ToString()) { var Cat = ProductProperties.Where((arg) => arg.PropertyName == "Parent Category"); var subCat = ProductProperties.Where((arg) => arg.PropertyName == "Category"); var name = ProductProperties.Where((arg) => arg.PropertyName == "Name"); if (Cat.Any()) { var selected = Cat.First().PropertyValue; Cat.First().ItemSource = Cat.First().AllSource; Cat.First().PropertyValue = selected; } if (subCat.Any()) { var selected = subCat.First().PropertyValue; subCat.First().ItemSource = subCat.First().AllSource; subCat.First().PropertyValue = selected; } if (name.Any()) { var selected = name.First().PropertyValue; name.First().ItemSource = name.First().AllSource; name.First().PropertyValue = selected; } } } }