listview - Change image by click of list view item in Visual Studio 2012 c# and xaml -
i trying build program includes listview, have listview in place want happen, isn't, when click on specific list view item want image change. using visual studio 2012 , designing windows store not windows phone
for example, have albert einstein first listview element, when user clicks on list view item picture of albert einstein appear in image element, vice versa when user clicks second element in listview image of galileo should appear, have images pre-loaded
private void listview_selectionchanged(object sender, selectionchangedeventargs e) { if (scientistlistview.selectedindex==0) { imageforscience.source = new imagesource(new uri("benjamin_franklin.png", urikind.absolute)); textbelowhistory.text = @"einstein born in 1879 in germany (ulm, wuttemberg) , died on april 18 1955 developed special , general theories of relativity while working in patent office einstein had time work on theories of relativity in 1915 einstein completed general theory of relativity
this way display image, assuming stored in 1 of folders, in examples i'm retrieving assets folder.
string path = "/assets/none.jpg"; uri uripath = new uri(path, urikind.relative); bitmapimage image1 = new bitmapimage(uripath); picturebox1.source = image1;
Comments
Post a Comment