using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ForeachSample
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (listFruits.SelectedItems.Count == 0) return;

            //将被选取项目复制到数组中处理
            object[] selectedFruits = new object[listFruits.SelectedItems.Count];
            listFruits.SelectedItems.CopyTo(selectedFruits, 0);

            //TODO: 使用foreach循环将所有选取的项目加入右边的ListBox控件中


        }
    }
}
