protected override void MovementGoodsReportOnPropertyChanged(object sender, PropertyChangedEventArgs ea) { if (ea.PropertyName == "IdCurrency" && CurrenciesList != null) { MovementGoodsReport.Rate = CurrenciesList.FirstOrDefault(c => c.Id == MovementGoodsReport.IdCurrency)?.Cost; } if ((ea.PropertyName == "IdCurrency" || ea.PropertyName == "IdEquivalentCurrency") && MovementGoodsReport.IdCurrency == MovementGoodsReport.IdEquivalentCurrency) { MovementGoodsReport.EquivalentRate = 1; } if (ea.PropertyName == "MovementGoodsInfosCollection") { RaisePropertyChanged(nameof(MovementGoodsInfosList)); } RaisePropertyChanged(nameof(MovementGoodsReport)); RaisePropertyChanged(nameof(CanAdd)); }
//Sets initial values for comboboxes public void SetSelectedCurrencies() { //From App.Config SelectedBase = CurrenciesList.FirstOrDefault (x => x.Contains(ConfigurationManager.AppSettings["DefaultBase"])); SelectedQuote = CurrenciesList.FirstOrDefault (x => x.Contains(ConfigurationManager.AppSettings["DefaultQuote"])); //Or defaults if (SelectedBase == null) { SelectedBase = CurrenciesList[0]; } if (SelectedQuote == null) { SelectedQuote = CurrenciesList[1]; } }