private void Convert_Click(object sender, RoutedEventArgs e) { var _dataFrom = FromConverter.SelectedItem as CurrencyDetail; var _dataTo = ToConverter.SelectedItem as CurrencyDetail; if (AmountConverter.Text == "") { AmountConverter.Focus(); MessageBox.Show("Enter Amount to Convert"); } else if (FromConverter.SelectedItem == ToConverter.SelectedItem) { MessageBox.Show("You are Selected Same From Currency and To Currency...."); } else { double _enteredAmount = Convert.ToDouble(AmountConverter.Text); double _fromCurrencyRate = Convert.ToDouble(_dataFrom.CurrencyRate); double _toCurrencyRate = Convert.ToDouble(_dataTo.CurrencyRate); double _convertedCurrency = Math.Round(((_enteredAmount * _toCurrencyRate) / _fromCurrencyRate), 3); //MessageBox.Show(string.Format("{0:0.00}",_convertedCurrency)); BeforeConvertedCurrency.Content = _enteredAmount.ToString() + " " + _dataFrom.CurrencyAbbrevation; t1.Visibility = Visibility.Visible; AfterConvertedCurrency.Content = _convertedCurrency.ToString() + " " + _dataTo.CurrencyAbbrevation; FromConvert.Content = "1 " + _dataFrom.CurrencyAbbrevation; double _oneConverCurrency = Math.Round((_toCurrencyRate / _fromCurrencyRate), 3); t2.Visibility = Visibility.Visible; ToConvert.Content = _oneConverCurrency.ToString() + " " + _dataTo.CurrencyAbbrevation; } }