using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using BS.Shared.DataContracts;

namespace BeWo.View.Search
{
	/// <summary>
	///     Interaction logic for SupportConceptTreeSearchView.xaml
	/// </summary>
	public partial class SupportConceptTreeSearchView : UserControl
	{
		public static readonly DependencyProperty ResultListBackgroundProperty = DependencyProperty.Register("ResultListBackground", typeof (Brush), typeof (SupportConceptTreeSearchView), new UIPropertyMetadata(Brushes.White, (s, e) => ((SupportConceptTreeSearchView) s).listbox_result.Background = e.NewValue as Brush));

		private List<SupportConceptTreeNodeDC> _List;

		public SupportConceptTreeSearchView()
		{
			InitializeComponent();
		}

		public List<SupportConceptTreeNodeDC> List
		{
			get { return _List; }

			set
			{
				_List = value;
				listbox_result.DataContext = _List.Cast<IFilterableDC>();
			}
		}

		public Brush ResultListBackground
		{
			get { return (Brush) GetValue(ResultListBackgroundProperty); }

			set { SetValue(ResultListBackgroundProperty, value); }
		}

		public TreeView ResultTree
		{
			get { return listbox_result; }
		}
	}
}