1 //----------------------------------------------------------------
2 // <copyright company="Microsoft Corporation">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //----------------------------------------------------------------
7 namespace System.Activities.Presentation
10 using System.Windows.Controls;
11 using System.Windows.Data;
13 internal partial class ActivityDelegateInfoPresenter : UserControl
15 public static readonly DependencyProperty DelegateInfoProperty = DependencyProperty.Register("DelegateInfo", typeof(ActivityDelegateInfo), typeof(ActivityDelegateInfoPresenter), new PropertyMetadata(new PropertyChangedCallback(OnDelegateInfoChanged)));
17 public ActivityDelegateInfoPresenter()
19 this.InitializeComponent();
22 public ActivityDelegateInfo DelegateInfo
26 return (ActivityDelegateInfo)GetValue(DelegateInfoProperty);
31 SetValue(DelegateInfoProperty, value);
35 private static void OnDelegateInfoChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
37 ActivityDelegateInfoPresenter presenter = sender as ActivityDelegateInfoPresenter;
39 presenter.OnDelegateInfoChanged();
42 private void OnDelegateInfoChanged()
44 if (this.DelegateInfo != null)
46 Binding binding = new Binding(this.DelegateInfo.PropertyName);
47 binding.Source = this.DelegateInfo.ModelItem;
48 binding.Mode = BindingMode.TwoWay;
50 this.activityDelegatePresenter.SetBinding(ActivityDelegatePresenter.ActivityDelegateProperty, binding);