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'帶來價值?