How to get Selected items in WPF CheckBox ListBox

前端 未结 3 1524
独厮守ぢ
独厮守ぢ 2020-12-21 23:13

Am Using the checkbox in listbox items, how to get the selected checkboxes from the list



        
3条回答
  •  無奈伤痛
    2020-12-21 23:50

    I would suggest this code:

     private void save_Click(object sender, RoutedEventArgs e)
     {
         foreach (CheckBox item in list1.Items)
         {
             if (item.IsChecked)
             {
                 MessageBox.Show(item.Content.ToString());
             }
         }
     }
    

提交回复
热议问题