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

前端 未结 5 1735
忘掉有多难
忘掉有多难 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条回答
  •  失恋的感觉
    2021-01-27 17:31

    public List BoothsInGroup1 { get; set; }
    
    BoothsInGroup1 = new List();
    
    BoothsInGroup1.Add(new { BoothID = da["BoothID"].ToString(), BoothName = da["BoothName"].ToString() });
    
    
    var Booth = (LstGroup1.SelectedItem);
    var output = Booth.BoothID;
    
        

    提交回复
    热议问题