private void Quantity_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "Text") { CustomStepper customStepper = (CustomStepper)sender; StackLayout listViewItem = (StackLayout)customStepper.Parent; Label pPrice = (Label)listViewItem.Children[0]; Label pbPrice = (Label)listViewItem.Children[2]; string prodPrice = pPrice.Text; string prodBasePrice = pbPrice.Text; Prod_Qty = sender.GetType().GetProperty(e.PropertyName).GetValue(sender).ToString(); pPrice.Text = (Convert.ToDecimal(Prod_Qty) * Convert.ToDecimal(prodBasePrice)).ToString(); } }
private async void Quantity_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "Text") { CustomStepper customStepper = (CustomStepper)sender; StackLayout listViewItem = (StackLayout)customStepper.Parent; Label label = (Label)listViewItem.Children[0]; Label pPrice = (Label)listViewItem.Children[1]; Label cPrice = (Label)listViewItem.Children[2]; string Cart_Id = label.Text; string prodPrice = pPrice.Text; string cartPrice = cPrice.Text; string Cart_Qty = sender.GetType().GetProperty(e.PropertyName).GetValue(sender).ToString(); await(this.BindingContext as CartViewModel).UpdateCart(Cart_Id, Cart_Qty); await(this.BindingContext as CartViewModel).LoadTotal(UserId, "11"); cPrice.Text = (Convert.ToDecimal(Cart_Qty) * Convert.ToDecimal(prodPrice)).ToString(); } }
void ConfigureCustomStepper() { // Set the background image. CustomStepper.SetBackgroundImage(UIImage.FromBundle("stepper_and_segment_background"), UIControlState.Normal); CustomStepper.SetBackgroundImage(UIImage.FromBundle("stepper_and_segment_background_highlighted"), UIControlState.Highlighted); CustomStepper.SetBackgroundImage(UIImage.FromBundle("stepper_and_segment_background_disabled"), UIControlState.Disabled); // Set the image which will be painted in between the two stepper segments (depends on the states of both segments). CustomStepper.SetDividerImage(UIImage.FromBundle("stepper_and_segment_divider"), UIControlState.Normal, UIControlState.Normal); // Set the image for the + button. CustomStepper.SetIncrementImage(UIImage.FromBundle("stepper_increment"), UIControlState.Normal); // Set the image for the - button. CustomStepper.SetDecrementImage(UIImage.FromBundle("stepper_decrement"), UIControlState.Normal); CustomStepperLabel.Text = GetStepperLabelText(CustomStepper); CustomStepper.ValueChanged += OnStepperValueChange; }