日期:2014-05-18  浏览次数:20860 次

【WPF】 将类中的某个成员的其中一个属性作为绑定源,如何写?
public class D
{
 //...
  public A a;
}

public class A
{
 public string TextDemo{ get; set; }
}


主类中实例化:
public D d;

添加DataContext 
this.LayoutRoot.DataContext = d;


在XAML中添加TextBlock 并进行Text属性与d.a的TextDemo进行绑定,应该怎么写
<TextBlock Text="{Binding ...}" Background="LightBlue"/>

------解决方案--------------------
多谢,接分了。