Created
June 23, 2014 15:36
-
-
Save wtuts/23e9380ee42f3a869d3c to your computer and use it in GitHub Desktop.
Data binding in listbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void firstmethod() | |
{ | |
//create a list of Resultclass | |
List<Resultclass> mylist = new List<Resultclass>(); | |
for (int i = 0; i < 8; i++) | |
{ | |
//Create a new object of Result class | |
Resultclass obj = new Resultclass(); | |
//add the corresponding data from the sample array | |
obj.name = studentnames[i]; | |
obj.marks = studentmarks[i]; | |
//add the object into the list created | |
mylist.Add(obj); | |
} | |
//Set the itemsource of the mylistbox created | |
mylistbox.ItemsSource = mylist; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment