내부 DependencyProperties가 변경된 경우 DependencyObject의 bindinigs에 알릴 수있는 방법이 있습니까? 내가 COLOR1, COLOR2 및 UseBothColors에 대한 값을 설정 세 별도의 양방향 바인딩이DependencyProperites가 변경된 경우 DependencyObject에 대한 호출 바인딩
public class BackgroundDef : DependencyObject
{
public static readonly DependencyProperty Color1Property =
DependencyProperty.Register("Color1", typeof(Color),
typeof(BackgroundDef), new UIPropertyMetadata(Colors.White));
public static readonly DependencyProperty UseBothColorsProperty =
DependencyProperty.Register("UseBothColors", typeof(bool),
typeof(BackgroundDef), new UIPropertyMetadata(false));
public static readonly DependencyProperty Color2Property =
DependencyProperty.Register("Color2", typeof(Color),
typeof(BackgroundDef), new UIPropertyMetadata(Colors.White));
public Color Color1
{
set { SetValue(Color1Property, value); }
get { return (Color)GetValue(Color1Property); }
}
public bool UseBothColors
{
set { SetValue(UseBothColorsProperty, value); }
get { return (bool)GetValue(UseBothColorsProperty); }
}
public Color Color2
{
set { SetValue(Color2Property, value); }
get { return (Color)GetValue(Color2Property); }
}
}
하는 경우 :
예를 들어,이 클래스가 있습니다. 그러나 BackgroundDef 인스턴스에 대한 바인딩도 있습니다.이 인스턴스는 브러시를 만들고 단추의 배경을 그려야합니다 (단색 또는 두 가지 그라디언트 색상). 내 문제는 DependencyProperties에 대한 양방향 바인딩이 속성을 업데이트하지만 클래스 인스턴스에 대한 바인딩이 호출되지 않는다는 것입니다. 분명히 전체 개체가 변경되지 않기 때문입니다. 어떤 생각 DependencyProperties 변경 될 때 어떻게 DependencyObject에 대한 바인딩을 호출 할 수 있습니까?