我有類Employee這是類似的東西。如何將集合綁定到WPF中的列表框?
class Emp
{
int EmpID;
string EmpName;
string ProjectName;
}
我有一個list<employee> empList
填充,並希望顯示它在列表框中。 我ListBox的的ItemSource屬性設置爲empList
和我的XAML代碼如下
<ListBox Name="lbEmpList">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Label Content="{Binding Path=EmpID}"></Label>
<Label Content="{Binding Path=EmpName}"></Label>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
不用說,這不工作...任何指針爲我在做什麼錯將是有益的.. 提前致謝
這個工作..感謝很多 – 2010-08-25 13:53:17