读书人

【WPF】 将类中的某个成员的其中一个属

发布时间: 2012-09-14 23:00:49 作者: rapoo

【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"/>

[解决办法]
多谢,接分了。

读书人网 >C#

热点推荐