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