Click here to Skip to main content
14,828,866 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,

I am trying to do something like this :
I have a listview which shows items in gridview .Now it has few columns and those columns are populated by some of the properties of the class.

Now what I want is when I select any row of the listview another textbox should be populate with one of the property of selected item.

In short :

a listview row is populated with a property which is Name property.
so when I select this item , this value should bind to a textbox control .

What I have tried:

I tried using some of the properites such as this :
Text="{Binding SelectedItem.Name, ElementName=list}"
but this does not work in my case.
Posted
Updated 17-Dec-20 10:59am

1 solution

Use the .SelectionChanged event on the Listview to set the text box to the selected item's properties(s).

Note: SelectionChanged can fire at startup while the ListView is being initialized by the framework; in which case, .SelectedIndex will be -1 and the event should be skipped.
   

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