Created
June 25, 2014 14:18
-
-
Save wtuts/e8ab9bea9fe4f93ab0a4 to your computer and use it in GitHub Desktop.
Listbox selected item
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
//Selection changed event handler for listbox | |
private void Selectionchanged_Eventhandler_of_Listbox(object sender, SelectionChangedEventArgs e) | |
{ | |
//Get the data object that represents the current selected item | |
Resultclass myobject = (sender as ListBox).SelectedItem as Resultclass; | |
//Checking whether that it is not null | |
if (myobject != null) | |
{ | |
//Now you can get the name and marks of selected student from the myobject | |
//Display the name and marks of Selected Student in the textblocks given below the listbox. | |
Studentnameblock.Text = myobject.name; | |
marksblock.Text = myobject.marks.ToString(); ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment