using System.Collections.ObjectModel;
using System.Windows;

namespace ListBoxSelectedItems_WPF
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
		private MyViewModel MyViewModel { get; set; }

		public MainWindow()
		{
			InitializeComponent();
			this.MyViewModel = new MyViewModel();
			this.DataContext = this.MyViewModel;
		}

		private void Button_Click_1(object sender, RoutedEventArgs e)
		{
			var items = this.ListBox.ItemsSource as ObservableCollection<Country>;
			this.MyViewModel.SelectedCountries = new System.Collections.ObjectModel.ObservableCollection<Country>()
			{
				items[0],
				items[5]
			};
		}
	}
}
