[amd64/tramp] hide interpreter specific trampoline behind ifdef
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / ActivityDelegateInfoPresenter.xaml.cs
1 //----------------------------------------------------------------
2 // <copyright company="Microsoft Corporation">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //----------------------------------------------------------------
6
7 namespace System.Activities.Presentation
8 {
9     using System.Windows;
10     using System.Windows.Controls;
11     using System.Windows.Data;
12
13     internal partial class ActivityDelegateInfoPresenter : UserControl
14     {
15         public static readonly DependencyProperty DelegateInfoProperty = DependencyProperty.Register("DelegateInfo", typeof(ActivityDelegateInfo), typeof(ActivityDelegateInfoPresenter), new PropertyMetadata(new PropertyChangedCallback(OnDelegateInfoChanged)));
16
17         public ActivityDelegateInfoPresenter()
18         {
19             this.InitializeComponent();
20         }
21
22         public ActivityDelegateInfo DelegateInfo
23         {
24             get
25             {
26                 return (ActivityDelegateInfo)GetValue(DelegateInfoProperty);
27             }
28
29             set
30             {
31                 SetValue(DelegateInfoProperty, value);
32             }
33         }
34
35         private static void OnDelegateInfoChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
36         {
37             ActivityDelegateInfoPresenter presenter = sender as ActivityDelegateInfoPresenter;
38
39             presenter.OnDelegateInfoChanged();
40         }
41
42         private void OnDelegateInfoChanged()
43         {
44             if (this.DelegateInfo != null)
45             {
46                 Binding binding = new Binding(this.DelegateInfo.PropertyName);
47                 binding.Source = this.DelegateInfo.ModelItem;
48                 binding.Mode = BindingMode.TwoWay;
49
50                 this.activityDelegatePresenter.SetBinding(ActivityDelegatePresenter.ActivityDelegateProperty, binding);
51             }
52         }
53     }
54 }