[NUI] Change GetDefaultWindow() to static func (#900)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / XamlBinding / Interactivity / Trigger.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Reflection;
4
5 using Tizen.NUI.Xaml;
6
7 namespace Tizen.NUI.Binding
8 {
9     [ContentProperty("Setters")]
10     [ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.PassthroughValueProvider")]
11     [AcceptEmptyServiceProvider]
12     internal sealed class Trigger : TriggerBase, IValueProvider
13     {
14         public Trigger([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType) : base(new XamlPropertyCondition(), targetType)
15         {
16         }
17
18         public BindableProperty Property
19         {
20             get { return ((XamlPropertyCondition)Condition).Property; }
21             set
22             {
23                 if (((XamlPropertyCondition)Condition).Property == value)
24                     return;
25                 if (IsSealed)
26                     throw new InvalidOperationException("Can not change Property once the Trigger has been applied.");
27                 OnPropertyChanging();
28                 ((XamlPropertyCondition)Condition).Property = value;
29                 OnPropertyChanged();
30             }
31         }
32
33         public new IList<Setter> Setters
34         {
35             get { return base.Setters; }
36         }
37
38         public object Value
39         {
40             get { return ((XamlPropertyCondition)Condition).Value; }
41             set
42             {
43                 if (((XamlPropertyCondition)Condition).Value == value)
44                     return;
45                 if (IsSealed)
46                     throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
47                 OnPropertyChanging();
48                 ((XamlPropertyCondition)Condition).Value = value;
49                 OnPropertyChanged();
50             }
51         }
52
53         object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
54         {
55             //This is no longer required
56             return this;
57         }
58     }
59 }