10
我有幾個例子,我想在數據網格中的單個列中有幾個控件。如何使用wpf將多個控件添加到數據網格的DataGridTemplateColumn?
例如,我有一個包含匹配描述,圖像源,時間戳,地理標記等圖像的數據集。我想在一列中顯示一個縮略圖圖像,並將大部分數據顯示在文本框中或標籤。其他數據集我需要文本框/複選框或文本框/組合框。
當我嘗試添加第二個控件時,我收到一個錯誤報告,屬性「VisualTree」被設置多次。
<DataGridTemplateColumn Header="Data" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Label Name="Description" Content="{Binding Desc}"></Label>
<Label Name="Camera" Content="{Binding Camera}"></Label>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
天才!謝謝,我從來沒有想過要使用佈局。再次感謝 – IanM 2011-01-20 06:54:42