Click here to Skip to main content
15,867,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a listview with some items, the list view is bind to an list of objects. When i select an item from the list view, i want to appear some buttons and TextBlock down from the listview and when i click on another item in listview i want other buttons and TextBlock to be shown. I think it has something to do with user control because i know that having all the buttons and TextBlocks one over another and just make them visible and hidden will not solve my problem nicely.

How can i make this nice?

Thanks,
Posted
Comments
[no name] 22-Jul-12 17:33pm    
Just like you said, make a user control.
Gabriel Sas 22-Jul-12 17:49pm    
but how can i set the user control to be shown in my MainWindow down the listview ?

What is the issue, do you want toi show more than one item ? Create a data bound control and add items to it, and they will all appear.
 
Share this answer
 
Comments
Gabriel Sas 22-Jul-12 17:48pm    
i don't want all of the controlls to appear, i want only some based on the selected item in listview, but what can i do to not have all of the controls one over another, but to have them in different "file" and only show the controls from one "file" based on the selected item from the listview
Christian Graus 22-Jul-12 17:50pm    
I have no idea what you mean. You mean that what controls show, depends on the data that goes in ? in that case, yes, write a user control that takes an instance of the objects you support, and changes what it shows according to the type of object. I'd aim for a property that is of the type of a base class, and uses the 'as' keyword to work out what it is, and what to do with it.
As Wes Aday suggested, you should create a usercontrol uielement.

When the user selects an item in the list, this will cause an event or if bound to a ViewModel, update a selected item property. From this you could use a mediator / event aggregator to control the two elements communications, or if you are just using code behind then just create a new instance of the usercontrol and insert into an area on the view.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900