I\'m working in WPF 4 / C#. I have two custom classes:
public class c1 {
public string prop1 { get; set; }
public c1() {
prop1 = \"world\";
Your obj1
is a field, not a property, therefore you can't access the C1 object.
Consider this instead:
public class c2 {
public string prop1 { get; set; }
private readonly c1 _obj1;
public c2() {
prop1 = "hello";
_obj1 = new c1();
}
public c1 PropObj1 { get { return _obj1; } }
}
And
<TextBlock DataContext="{DynamicResource c2}" Text="{Binding PropObj1.prop1}"/>
PS. Next time better to use an example with standard naming conventions (e.g. lower case fields/variables, upper case properties etc) to allow people to see the problem sooner!
You can't bind to fields, they have to be properties.