private void InfoButton_Click(object sender, RoutedEventArgs e) { if (ProfitListBox.SelectedItem != null) { var transaction = service.GetTransaction(int.Parse(ProfitListBox.SelectedIndex.ToString())); MessageBox.Show($"Transaction: {transaction.Id}, Time: {transaction.Time}, Amount: {transaction.Amount}"); } }