using System;
using System.Collections.Generic;
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;
using System.ComponentModel;
using System.Collections.ObjectModel;
using Telerik.Windows;
using Telerik.Windows.Controls.DragDrop;

namespace SilverlightApplication1
{
	public partial class MainPage : UserControl
	{
		public MainPage()
		{
			InitializeComponent();

			this.treeView1.ItemsSource = new DataItems();
			this.treeView2.ItemsSource = new ObservableCollection<DataItem>();

			treeView1.PreviewDragEnded += new Telerik.Windows.Controls.RadTreeViewDragEndedEventHandler(treeView1_PreviewDragEnded);
		}

		void treeView1_PreviewDragEnded(object sender, Telerik.Windows.Controls.RadTreeViewDragEndedEventArgs e)
		{
			e.Handled = true;
		}
	}

	public class DataItems : ObservableCollection<DataItem>
	{
		public DataItems()
		{
			for (int i = 0; i < 5; i++)
			{
				DataItem dataItem = new DataItem();
				dataItem.Name = string.Format("Item {0}", i);

				for (int j = 0; j < 5; j++)
				{
					DataItem subDataItem = new DataItem();
					subDataItem.Name = string.Format("Item {0}.{1}", i, j);
					dataItem.Children.Add(subDataItem);
				}

				this.Add(dataItem);
			}
		}
	}

	public class DataItem
	{
		public DataItem()
		{
			this.Children = new ObservableCollection<DataItem>();
		}
		public string Name { get; set; }
		public ObservableCollection<DataItem> Children { get; set; }
	}
}
