现有实体类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 = } >