void CreateProductCommand_Execute(object oParameter) { m_oSelectedProduct = new Product(); EditProductPopup = new Popup(); EditProductPopup.VerticalOffset = 90; EditProductPopup.HorizontalOffset = 40; EditProductControl oEditCategoryControl = new EditProductControl(); EditProductPopup.Child = oEditCategoryControl; EditProductPopup.IsOpen = true; oEditCategoryControl.OKButton.Click += (s, args) => { EditProductPopup.IsOpen = false; m_oSelectedProduct.CreatedDate = DateTime.Now; // Make sure it has a name to prevent crashing in reports graph if (string.IsNullOrWhiteSpace(m_oSelectedProduct.Name)) { m_oSelectedProduct.Name = "Untitled"; } Products.Add(m_oSelectedProduct); OnPropertyChanged("Products"); }; oEditCategoryControl.CancelButton.Click += (s, args) => { EditProductPopup.IsOpen = false; }; }
void EditProductCommand_Execute(object oParameter) { EditProductPopup = new Popup(); EditProductPopup.VerticalOffset = 90; EditProductPopup.HorizontalOffset = 40; EditProductControl oEditProductControl = new EditProductControl(); EditProductPopup.Child = oEditProductControl; EditProductPopup.IsOpen = true; oEditProductControl.OKButton.Click += (s, args) => { EditProductPopup.IsOpen = false; OnPropertyChanged("SelectedProduct"); }; oEditProductControl.CancelButton.Click += (s, args) => { EditProductPopup.IsOpen = false; }; }