//
// Copyright (c) 2015, MindFusion LLC - Bulgaria.
//

using System;
using System.Globalization;
using System.Windows.Data;
using System.Xml.Linq;


namespace MindFusion.Reporting.Wpf.Samples.CS.LinqBinding
{
	public class LinqConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			var element = value as XElement;
			if (element != null)
			{
				if (parameter is string)
					return element.Elements(parameter.ToString());
			}

			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new NotImplementedException();
		}
	}
}
