summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml/MarkupExtensions/BindingExtension.cs
blob: f9af72a44f6d26f2d832fb7a51411bdf8bd177e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;

namespace Xamarin.Forms.Xaml
{
	[ContentProperty("Path")]
	public sealed class BindingExtension : IMarkupExtension<BindingBase>
	{
		public BindingExtension()
		{
			Mode = BindingMode.Default;
			Path = Binding.SelfPath;
		}

		public string Path { get; set; }

		public BindingMode Mode { get; set; }

		public IValueConverter Converter { get; set; }

		public object ConverterParameter { get; set; }

		public string StringFormat { get; set; }

		public object Source { get; set; }

		BindingBase IMarkupExtension<BindingBase>.ProvideValue(IServiceProvider serviceProvider)
		{
			return new Binding(Path, Mode, Converter, ConverterParameter, StringFormat, Source);
		}

		object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
		{
			return (this as IMarkupExtension<BindingBase>).ProvideValue(serviceProvider);
		}
	}
}