I'm creating dependency property in my custom controll class DataPoint:
public abstract class DataPoint : Control
{
public Color BaseColor
{
get { return (Color)GetValue(BaseColorProperty); }
set { SetValue(BaseColorProperty, value); }
}
public static readonly DependencyProperty BaseColorProperty =
DependencyProperty.Register("BaseColor", typeof(Color), typeof(DataPoint), new UIPropertyMetadata(Colors.DarkRed));
// Other class stuff
}
Then I create other custom control AreaDataPoint inheriting DataPoint:
public class AreaDataPoint : DataPoint
{
static AreaDataPoint()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(AreaDataPoint), new FrameworkPropertyMetadata(typeof(AreaDataPoint)));
}
// Other class stuff
}
In xaml I'm trying to assign value to BaseColor property, but it doesn't work
<Style TargetType="{x:Type local1:AreaDataPoint}">
<Setter Property="BaseColor" Value="DarkGreen" />
</Style>