Help to understand, I do not understand how to debug the code or why it does not work.
There is a window in which there is a class created in the constructor.
public class mainWindow : Window { private readonly Class1 _cls1 = new Class1(); public Class1 cls1 { get { return _cls1; } } } Class1 is a BaseClass derived
public class Class1 : BaseClass { } BaseClass is a descendant of DepencesObject in which the DependencyProperty property is defined
public class BaseClass : DepencesObject { public string Field { get{return(string)Getvalue(FieldProperty);} set{SetValue(FieldProperty, value);} } public static readonly DependencyProperty FieldProperty = DependencyProperty.register("Field", typeof(string), typeof(string)); } In the XAML form spelled:
<TextBlock Text="{Binding cls1.Field}"/> But either the binding fails, or the data from the Field is not updated (at the time of form creation there "")
What am I wrong?
cls1go? How should the UI know thatcls1updated? - Andrey NOPcls1 = new ...- where? - Andrey NOP