Wyświetlenie wartości z dwóch Comboxów

0

Cześć, nie wiem jak wyświetlić wartości z dwóch comboxów. Każda wybrany element ma przypisany z góry wartość. Chciałbym, aby jeśli wybiorę np Salaries Report to wyświetli mi wartość EmountSA, która ma swoją wartość, oraz jeśli wybiorę np. Individual Work Time Report to wybierając ID Usera pokaże mi przypisany do niego czas pracy. Nie wiem jak wyświetlić to w messageboxie, aby pokazało mi wartość a nie sam wybrany raport.

namespace WpfApp1
{
    /// <summary>
    /// Logika interakcji dla klasy MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;
            Users = new List<ReportPanel>
            {

               
                new ReportPanel {ID = "1"},
                 new ReportPanel {ID = "2"},
                  new ReportPanel {ID = "3"},
                   new ReportPanel {ID = "4"},
                    new ReportPanel {ID = "5"},
                     new ReportPanel {ID = "6"},
                      new ReportPanel {ID = "7"},
                       new ReportPanel {ID = "8"},
                        new ReportPanel {ID = "9"},
                         new ReportPanel {ID = "10"},
            };

            DataContext = this;

            Reports = new List<ReportGenerator>
            {
                new ReportGenerator {Report = "Salaries Report" , Values =new Dictionary<string, int>(){ { "EmountSA",77500 } }},
                new ReportGenerator {Report = "All Movies Report", Values = new Dictionary<string, int>(){ { "EmountAMR", 560 } } },
                new ReportGenerator {Report = "Incomes Report", Values = new Dictionary<string, int>(){ { "EmountIR", 4000 } }},
                new ReportGenerator {Report = "Food Sale Report", Values = new Dictionary<string, int>(){ { "EmountFSR", 19000 } }},
                new ReportGenerator {Report = "Salary Report", Values = new Dictionary<string, int>(){ { "EmountSR", 35000 } } },
                new ReportGenerator {Report = "Individual Work Time Report",
                        Values = new Dictionary<string, int>()
                        {
                            { "WorkTimeID1", 150 },
                            { "WorkTimeID2", 160 },
                            { "WorkTimeID3", 168 },
                            { "WorkTimeID4", 161 },
                            { "WorkTimeID5", 159 },
                            { "WorkTimeID6", 184 },
                            { "WorkTimeID7", 70 },
                            { "WorkTimeID8", 188 },
                            { "WorkTimeID9", 162 },
                            { "WorkTimeID10", 169 },
                        }},
                new ReportGenerator {Report = "Individual Salary Report",
                        Values = new Dictionary<string, int>()
                        {
                            { "SalaryID1", 2150 },
                            { "SalaryID2", 3150 },
                            { "SalaryID3", 2450 },
                            { "SalaryID4", 2250 },
                            { "SalaryID5", 2100 },
                            { "SalaryID6", 2400 },
                            { "SalaryID7", 1550 },
                            { "SalaryID8", 3000 },
                            { "SalaryID9", 1850 },
                            { "SalaryID10", 1900 },
                        }}
            };

           
        }
        public List<ReportGenerator> Reports { get; set; }

              public List<ReportPanel> Users { get; set; }
                    
    
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
             
        }

      

        private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {


      
        }
       
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ReportGenerator reportGenerator = ComboBox1.SelectedItem as ReportGenerator;
            ReportPanel reportPanel = ComboBox2.SelectedItem as ReportPanel;

            //var keyValuePair = ReportGenerator.Values.Where(user => user.Key.Substring(user.Key.IndexOf("ID") + 2) == ReportPanel.ID).FirstOrDefault();




            string gettvalue = ComboBox1.SelectedValue.ToString();
            string getvalu1 = ComboBox2.SelectedValue.ToString();
            MessageBox.Show(" Id User: " + gettvalue + ": " + gettvalue);


        }
    }


}


 public class ReportPanel
    {



       




    public string ID { get; set; }
      
    }






}


public  class ReportGenerator
    {

        public string Report { get; internal set; }
        public Dictionary<string, int> Values { get; set; }


     


    }
}

0

Zupełnie nie rozumiem tego kodu ani opisu

ALE

Do Combo tradycyjnie podaje się string'i, ale nie musi tak być.
Mogą to być "inteligentne" obiekty, byle miały ToString() dla celów wyświetlenia się - podczas zdarzeń przez rzutowanie można dojść do tego, który obiekt jest aktualny, mogą nosić informację
Mozę ci sie to przyda

0

To może inaczej. Mam dwa Comboboxy. W jednym wyświetlają się raporty, a w drugim ID użytkowników. Dane są stałe. Jeśli wybiorę np. "Salaries Report" to do niego jest już przypisana wartość(EmountSA =77500). Nie wiem jak wyświetlić taką informacje : "Salaries Report = 77500". Oraz jeśli wybiorę raport indywidualny, to, w drugim comboboxie wybierając odpowiednie ID użytkownika wyświetli się taki komunikat : " Individual Work Time for ID5 = 159".

1 użytkowników online, w tym zalogowanych: 0, gości: 1