WPF: C# How to get selected value of Listbox?

前端 未结 5 1746
忘掉有多难
忘掉有多难 2021-01-27 17:00

I am trying to fetch the selected value of the listbox. When I actually try LstGroup1.SelectedItem I get the value { BoothID = \"4\", BoothName = \"HP\" }

5条回答
  •  梦毁少年i
    2021-01-27 17:35

    You can always create a class called Booth to get the data in the Object Format. From My point of view Dynamic is not the right way of doing this. Once you have the Class Booth in the Solution you can run

    Booth Booth1 = LstGroup1.SelectedItem as Booth;
    string BoothID1 = Booth1.BoothID;
    

提交回复
热议问题