当前位置: 代码迷 >> .NET新技术 >> WPF Binding Path 请问
  详细解决方案

WPF Binding Path 请问

热度:487   发布时间:2016-04-25 01:48:37.0
WPF Binding Path 请教
现有实体类Common

public class Common
{
private decimal price;
private decimal number = 1;
private decimal total = 0;
private PRODUCTINFO productinfo = new PRODUCTINFO();

CLR属性省略
.........


}

public class PRODUCTINFO 
{
private string name;
}

PURCHASEPRODUCT purchaseProduct= new PURCHASEPRODUCT();
this.DataContext = purchaseProduct;

现在可以用Binding Path 为控件针对purchaseProduct进行绑定
但是我想绑定purchaseProduct.productinfo 的name属性。不知道Path 格式怎么写?

/PRODUCTINFO.Name 不对


------解决方案--------------------
control.DisplayFieldPath=purchaseProduct.productinfo.name
还有ValuePath
好像是这两个
------解决方案--------------------
在code behind 里面设置this.DataContext = your variable
然后在xaml里面写<YourControl YourItem = {Binding Path = } >
  相关解决方案