i have a question, i have created a ListBoxItem in extression blend, which has a StackPanel and this contains a Image and TextBlock.
the problem is, that i dont know how to set a property to get access to the image and textblock to set it.
i can create new item but how to set the image url and text?
The XAML needs to bind to the properties in the datasource, and the ItemsSource of the ListBox needs to be set. I include below the xaml and .cs that generates the screen shot shown. I have also included a simple class that contains the data.
The .cs for the MainPage should include:
My data object is called dataItem and looks like so:
I have implemented INotifyPropertyChanged to ensure that the UI is updated as new items are added to the datasource (dataItem). The images need to be added as content and should be Copy Always to ensure they are on the device. The finished app looks like:
I hope this helps.
Jason.