using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

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

		public MainPage()
		{
			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]
			};
		}
	}
}
