MY TASK: I have ListBox
and Grid
. 1. ListBoxSource
and 2. GridDetails
(with 2 columns and 2 rows) (This can be change to anything) Now, all I want is to display the images in a ListBox
( ListBoxSource
) from a folder named "MyImages" and then I want those selected images from the ListBoxSource
to TRANSFER into another ListBox
( ListBoxDetails
) or Grid
or whatever control that can handle it AND places the selected images to another directory called "MySelectedImages"
My Problem: - Base on my scenario, HOW will I display/show my selected images to my Grid
(define with 2 columns and 2 rows (total 4 cells)) and fill or add each cell with the selected image.
Can someone show me some solution code or link related to my problem? I will try to study it. I do have only basic learnings of C# and XAML. (I'm using Blend most of the time)
It sounds like you want to create a DataTemplate
for the items inside your ListBox
control. See here for information on how to go about creating a DataTemplate
. You then want to have some collection of images that you can build when reading from the folder and pass that collection to your ListBox
's ItemsSource
property. Refer to this StackOverflow question for more details on how to go about implementing this set up.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.