I have a custom wifi signal strength control, i am working on so the control comprise of arcs and an ellipse. Depends on dbs of Wifi strength, each arc should fill accordingly.
You must adhere to dependency property naming conventions, where the DependencyProperty identifier field is named like the property with a Property
suffix:
private static readonly DependencyProperty State1ColorProperty =
DependencyProperty.Register(nameof(State1Color), typeof(Brush), typeof(WifiControl));
public Brush State1Color
{
get { return (Brush)GetValue(State1ColorProperty); }
set { SetValue(State1ColorProperty, value); }
}
The Binding should then look like shown below. Setting UpdateSourceTrigger=PropertyChanged
is pointless.
Fill="{Binding ElementName=_this, Path=State1Color}"
or
Fill="{Binding State1Color, ElementName=_this}"
or
Fill="{Binding State1Color, RelativeSource={RelativeSource AncestorType=UserControl}}"
I'd also recommand to rename your properties to StateXBrush
instead of StateXColor
, because they are Brushes, not Colors.