public OrderControl() { InitializeComponent(); CurrentOrder = new Order(new Customer()); OrderSummaryView = new OrderSummaryControl(); // Binding data of Temporary Order To OrderSummaryControl BindingOrderDataToOrderView(CurrentOrder, OrderSummaryView); ScanProduct += ScanItem; }
//binding ordersummary private void BindingOrderDataToOrderView(Order orderData, OrderSummaryControl orderUI) { Binding bindingOrderSubTotal = new Binding("SubTotal", orderData, "SubTotal", true, DataSourceUpdateMode.OnPropertyChanged); orderUI.DataBindings.Add(bindingOrderSubTotal); Binding bindingOrderTax = new Binding("Tax", orderData, "Tax", true, DataSourceUpdateMode.OnPropertyChanged); orderUI.DataBindings.Add(bindingOrderTax); Binding bindingOrderDiscount = new Binding("Discount", orderData, "Discount", true, DataSourceUpdateMode.OnPropertyChanged); orderUI.DataBindings.Add(bindingOrderDiscount); Binding bindingOrderTotal = new Binding("Total", orderData, "Total", true, DataSourceUpdateMode.OnPropertyChanged); orderUI.DataBindings.Add(bindingOrderTotal); }