我有這個類:WPF結合亞類的ListView
public class Car
{
public struct CarType
{
public string Manufacturer { get; set; }
public string Model { get; set; }
public int Year { get; set; }
}
public CarType Type;
public string LicenseNumber { get; set; }
public int Km { get; set; }
}
要綁定LicenseNumber或公里到我的列表視圖,我用:
<ListView.View>
<GridView>
<GridViewColumn Width="140" DisplayMemberBinding="{Binding LicenseNumber}">
<GridViewColumn.Header>
<GridViewColumnHeader Click="GridViewColumnHeader_Click">License Number</GridViewColumnHeader>
</GridViewColumn.Header>
</GridViewColumn>
</GridView>
</ListView.View>
命令DisplayMemberBinding="{Binding LicenseNumber}"
結合LicenseNumber財產。
但是如何綁定子類。像Type.Manufacturer? Type.Model?
我使用的ListView不TextBlock中...... ListView控件不具有 「文本」 的屬性... – Nick