Silverlight listbox selected item template
-
Hi... So I want to change the item template for the selected item of a listbox. I know I need to use the VisualStatemanager to do this, but I'm not sure how to do it. All of the example I've found seem to be much more complicated than I need and/or I can't get them to work. Basically, for an unselected item, I need to display the name property. And for a selected item I need to display a few other things. So My understanding is that I should use two different grids, and use the VisualState to turn toggle the visibility of the "detail" info. Can someone throw me a simple example? Thanks.
-
Hi... So I want to change the item template for the selected item of a listbox. I know I need to use the VisualStatemanager to do this, but I'm not sure how to do it. All of the example I've found seem to be much more complicated than I need and/or I can't get them to work. Basically, for an unselected item, I need to display the name property. And for a selected item I need to display a few other things. So My understanding is that I should use two different grids, and use the VisualState to turn toggle the visibility of the "detail" info. Can someone throw me a simple example? Thanks.
USAFHokie80 wrote:
Hi... So I want to change the item template for the selected item of a listbox. I know I need to use the VisualStatemanager to do this, but I'm not sure how to do it. All of the example I've found seem to be much more complicated than I need and/or I can't get them to work.
Basically, for an unselected item, I need to display the name property. And for a selected item I need to display a few other things. So My understanding is that I should use two different grids, and use the VisualState to turn toggle the visibility of the "detail" info. Can someone throw me a simple example?No, you do not use VisualStateManager for this. There are two ways to go about this. If you want to keep your selected item and unselected item template completely separate, you can define two separate DataTemplates (selected & unselected) and swap them out in ListBoxItem via a trigger. It sounds like what would be better in your case is to have a single template where you just collapse visibility on the stuff you don't want to show via a trigger.
-
Hi... So I want to change the item template for the selected item of a listbox. I know I need to use the VisualStatemanager to do this, but I'm not sure how to do it. All of the example I've found seem to be much more complicated than I need and/or I can't get them to work. Basically, for an unselected item, I need to display the name property. And for a selected item I need to display a few other things. So My understanding is that I should use two different grids, and use the VisualState to turn toggle the visibility of the "detail" info. Can someone throw me a simple example? Thanks.