2
如何將畫布放置在ListView
控件的特定欄內?如何將畫布放在ListView控件的特定列中?
我有這樣的:
<DataTemplate>
<Canvas Width="60" Height="20" Background="Red" ClipToBounds="True" >
<ContentPresenter Content="{Binding Path=Graph}" />
</Canvas>
</DataTemplate>
和:
var canvas = new Canvas();
canvas.Children.Add(new Ellipse(){});
var items = new ObservableCollection<LvItem>() { new LvItem(){ Graph = canvas} };
myListView.ItemsSource = items;
但它顯示System.Windows.Controls.Canvas
爲文本,而不是畫布本身及其附圖。
這很令人尷尬......我很久沒有注意到我在'GridViewColumn'屬性中有'DisplayMemberBinding =「{Binding Graph}」'...感謝您確認它確實工作,我專注於找到我的錯誤... – Tar