Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια

C# and .NET Tips and Tricks

Quests in programming in .NET
ListBoxes with DataBound Images in WPF
In this post, we see how we can add a DataBound image in the DataTemplate of a WPF ListBox. We experiment with three different approaches of achieving that and discuss on which one to use depending on the situation. In all cases, the image files are embedded within the application as “Resource” files. Later in this post, we will see what needs to be changed in order to support having the image files in a folder outside of the application Assembly. Our object for binding will be the class named Item having the following properties: public class Item { public int PictureID { get ; set ; } public string Name { get ; set ; } } We want to display a specific image depending on the value of the property PictureID. The ListBox in the .xaml file be: < ListBox ItemTemplate ="{ DynamicResource DataTemplateItem }" ItemsSource ="{ Binding Items }" /> The definition of the DataTemplate for the items of the ListBox is: < DataTemplate x : Key ="DataTemplateItem"> < Canvas

Διαβάστε περισσότερα »

Share
Posted: Τετάρτη, 12 Ιανουαρίου 2011 9:19 μμ από το μέλος iwannis
Δημοσίευση στην κατηγορία:

Σχόλια:

Χωρίς Σχόλια

Ποιά είναι η άποψή σας για την παραπάνω δημοσίευση;

(απαιτούμενο)

(απαιτούμενο)

(προαιρετικό)

(απαιτούμενο)
ÅéóÜãåôå ôïí êùäéêü:
CAPTCHA Image

Ενημέρωση για Σχόλια

Αν θα θέλατε να λαμβάνετε ένα e-mail όταν γίνονται ανανεώσεις στο περιεχόμενο αυτής της δημοσίευσης, παρακαλούμε γίνετε συνδρομητής εδώ

Παραμείνετε ενήμεροι στα τελευταία σχόλια με την χρήση του αγαπημένου σας RSS Aggregator και συνδρομή στη Τροφοδοσία RSS με σχόλια