/
CaptionControl.xaml.cs
40 lines (35 loc) · 1.11 KB
/
CaptionControl.xaml.cs
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
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
namespace NotEdible
{
public partial class CaptionControl : UserControl, INotifyPropertyChanged
{
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CaptionControl), null);
public string Text
{
get { return (string)GetValue(TextProperty); }
set
{
if (value != Text)
{
SetValue(TextProperty, value);
NotifyPropertyChanged("Text");
}
}
}
public CaptionControl()
{
InitializeComponent();
this.DataContext = this;
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}