1
考虑以下代码:的DataTemplate问题(指定值时,属性)
public class customlistbox : ListBox
{
public customlistbox()
{
this.itemtemplate = this.gettemplate();
}
private string gettemplate()
{
return ".......<locall:CustomGrid Background='" + Background.Color + "' ParentReference='" + this + "' > "....."
}
}
'ParentReference' 是它的类型是customlistbox的属性。但我给ParentReference ='“+这个+”',它显示错误。我怎么能在这种情况下给'ParentReference'带来价值?