public class ColorPicker : Control
{
static ColorPicker()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorPicker), new FrameworkPropertyMetadata(typeof(ColorPicker)));
}
///
/// CurrentColor Dependency Property
///
public static readonly DependencyProperty CurrentColorProperty =
DependencyProperty.Register("CurrentColor", typeof(Brush), typeof(ColorPicker),
new FrameworkPropertyMetadata((Brush)Brushes.White, FrameworkPropertyMetadataOptions.AffectsRender,
new PropertyChangedCallback(OnCurrentColorChanged)));
///
/// Gets or sets the CurrentColor property. This dependency property
/// indicates ....
///
public Brush CurrentColor
{
get { return (Brush)GetValue(CurrentColorProperty); }
set { SetValue(CurrentColorProperty, value); }
}
///
/// Handles changes to the CurrentColor property.
///
private static void OnCurrentColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
}
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
public Brush AnnotationOutLineColor
{
get { return (Brush)GetValue(AnnotationOutLineColorProperty); }
set { SetValue(AnnotationOutLineColorProperty, value); }
}
public static readonly DependencyProperty AnnotationOutLineColorProperty = DependencyProperty.Register(
"AnnotationOutLineColor",
typeof(Brush),
typeof(Window1),
new FrameworkPropertyMetadata(Brushes.Green, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnAnnotationOutLineColorChanged)));
private static void OnAnnotationOutLineColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
private void button1_Click(object sender, RoutedEventArgs e)
{
this.AnnotationOutLineColor = Brushes.Blue;
}
}
|