public class Lamp : System.Windows.Controls.Image
{
public static DependencyProperty ImageOnDependencyProperty = DependencyProperty.Register(
"ImageOn"
,
typeof(ImageSource),
typeof(Lamp),
new PropertyMetadata(null));
[Category(
"Images"
)]
public ImageSource ImageOn
{
get { return (ImageSource)GetValue(ImageOnDependencyProperty); }
set { SetValue(ImageOnDependencyProperty, value); }
}
public static DependencyProperty ImageOffDependencyProperty = DependencyProperty.Register(
"ImageOff"
,
typeof(ImageSource),
typeof(Lamp),
new PropertyMetadata(null));
[Category(
"Images"
)]
public ImageSource ImageOff
{
get { return (ImageSource)GetValue(ImageOffDependencyProperty); }
set { SetValue(ImageOffDependencyProperty, value); }
}
public static DependencyProperty LampStatusDependencyProperty = DependencyProperty.Register(
"LampStatus"
,
typeof(bool),
typeof(Lamp),
new PropertyMetadata(null));
[Category(
"Control"
)]
public bool LampStatus
{
get { return (bool)GetValue(LampStatusDependencyProperty); }
set
{
Source = value ? ImageOn : ImageOff;
SetValue(LampStatusDependencyProperty, value);
}
}
}