請參閱下面的代碼添加本地文件夾的圖像到ListView:如何將複選框添加到ListView中的圖像?
for (int i = 0; i < num_of_slides; i++) //populate the thumbnail list
{
var fileName = @dir + (i+1) + ".png";
var bitmap = new BitmapImage(new Uri(fileName));
Image image = new Image() { Source = bitmap };
image.Width = 140;
CheckBox checkbox = new CheckBox();
Thumbnails.Items.Add(image);
//Thumbnails.Items.GetItemAt(i); here I want to somehow access current image and add checkbox in corner within that image
}
如何每幅圖像內添加一個複選框,但不被視爲ListView的元素,但不是一個子元素每張照片?
心不是ListView.CheckBoxes你需要什麼? https://msdn.microsoft.com/en-us/library/system.windows.forms.listview.checkboxes(v=vs.110).aspx –
我相信是的。但是,我的ListView「縮略圖」是在XAML中創建的,顯然沒有CheckBoxes屬性。或者我錯過了什麼? – user1394252