You can add PropertyChanged
callback to your DependencyProperty
declaration like
public static readonly DependencyProperty LineCountProperty = DependencyProperty.Register(
"LineCount",
typeof(int),
typeof(Window),
new FrameworkPropertyMetadata(
0,
new PropertyChangedCallback(OnLineCountChanged)
)
);
private static void OnLineCountChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
//Here you call you function on `d` by typecasting it into your class
}