aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Editors/ParameterItemEditor.cs
blob: bb0a321f54b096c48a16244a9adce5b7e96e6ae7 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Tango.Core;

namespace Tango.SharedUI.Editors
{
    /// <summary>
    /// Represents a <see cref="ParameterItem"/> editor base class.
    /// </summary>
    public class ParameterItemEditor : UserControl, IParameterItemEditor
    {
        /// <summary>
        /// Gets or sets the parameter item.
        /// </summary>
        public ParameterItem ParameterItem
        {
            get { return (ParameterItem)GetValue(ParameterItemProperty); }
            set { SetValue(ParameterItemProperty, value); }
        }
        public static readonly DependencyProperty ParameterItemProperty =
            DependencyProperty.Register("ParameterItem", typeof(ParameterItem), typeof(ParameterItemEditor), new PropertyMetadata(null));

        /// <summary>
        /// Gets or sets the parameterized object.
        /// </summary>
        public IParameterized ParameterizedObject
        {
            get { return (IParameterized)GetValue(ParameterizedObjectProperty); }
            set { SetValue(ParameterizedObjectProperty, value); }
        }
        public static readonly DependencyProperty ParameterizedObjectProperty =
            DependencyProperty.Register("ParameterizedObject", typeof(IParameterized), typeof(ParameterItemEditor), new PropertyMetadata(null));

        /// <summary>
        /// Initializes a new instance of the <see cref="ParameterItemEditor"/> class.
        /// </summary>
        public ParameterItemEditor()
        {
            DataContext = ParameterItem;
            this.Loaded += ParameterItemEditor_Loaded;
        }

        /// <summary>
        /// Handles the Loaded event of the ParameterItemEditor control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void ParameterItemEditor_Loaded(object sender, RoutedEventArgs e)
        {
            DataContext = ParameterItem;
        }
    }
}