Just a short question, to clarify some doubts. Are setters not run when an element is bound to a dependency property?
public string TextContent
{
get { return (string)GetValue(TextContentProperty); }
set { SetValue(TextContentProperty, value); Debug.WriteLine("Setting value of TextContent: " + value); }
}
public static readonly DependencyProperty TextContentProperty =
DependencyProperty.Register("TextContent", typeof(string), typeof(MarkdownEditor), new UIPropertyMetadata(""));
...
<TextBox Text="{Binding TextContent}" />
As I noticed the below in my setter does not run
Debug.WriteLine("Setting value of TextContent: " + value);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…