private void BtnAdd_Click(object sender, RoutedEventArgs e) { var vm = DataContext as MainWindowViewModel; vm.AddNewAgent(); LbxAgents.SelectedIndex = LbxAgents.Items.Count - 1; TbxId.Focus(); }
private void BtnAddToDataGridView_Click(object sender, EventArgs e) { _productList.Add(new Product(Guid.Parse(TbxId.Text), TbxName.Text, double.Parse(TbxPrice.Text), TbxCountry.Text, double.Parse(TbxSale.Text))); DgridProducts.Rows.Add(DgridProducts.RowCount + 1, TbxId.Text, TbxName.Text, TbxPrice.Text, TbxCountry.Text, TbxSale.Text); TbxId.Clear(); TbxName.Clear(); TbxPrice.Clear(); TbxCountry.Clear(); TbxSale.Clear(); }