I have a List. It is populated with CustomObjects when a query is run on a database (and matching results are put into this List)
However, I then want to display each of the e.g. name properties of these resultant custom objects in a listview, this is the part that is causing me trouble.
Im unsure how to set up the template of the list view to display the data from the list. The furthest I have been able to get is as follows: If the result of the query has 3 matches, I can make 3 textboxes saying "HELLO" appear in the list view. This is achieved by putting a textbox saying "HELLO" in the template part of the listview (which is otherwise laid out as it is in the grid template of VS2012). Is the solution something to do with bindings?
Any help would be much appreciated. (working on a metro app, windows 8, .NET 4.5)
what I currently have looks something like this
List<CustomObject> CustObjList =... //gets matches from database
listView.ItemsSource = CustObjList;
then in the XAML is this
<ListView.ItemTemplate>
<DataTemplate>
<UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates">
<ScrollViewer x:Name="scrollViewer" Style="{StaticResource HorizontalScrollViewerStyle}" Grid.Row="1">
<TextBlock x:Name="listViewText" Text="HELLO" <--(???) Margin="30,0,0,0" Foreground="Black"/>