how to customize the listbox selected item style i

2019-03-04 10:51发布

问题:

I am having a silverlight listbox in which a list item contains an image, its name and its price. the layout of the list item will be as follows: Under the image the image name will be shown, under the image name the price will be shown.

Now the problem is when i select an list item all the three items(image, image name and its price ) are selected. this is the default behavior.

Now the requirement is when i select a list item only the image should be selected.

please let me know if there is a way to do this..

回答1:

You'll need to customize the Visual State "Selected" of the Listbox template you are using. Check out some tutorials on how VSM works.

  • http://timheuer.com/blog/archive/2008/06/04/silverlight-introduces-visual-state-manager-vsm.aspx
  • http://weblogs.asp.net/dwahlin/archive/2008/11/23/using-the-visual-state-manager-in-silverlight-templates.aspx
  • http://www.c-sharpcorner.com/UploadFile/mdobbles/SilverlightVsmNavbar08062008002808AM/SilverlightVsmNavbar.aspx