Click here to Skip to main content
16,019,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I m learning MVVM.. I have a datagrid in my View and a textbox,combobox,checkbox. Now what I want to do is to fill the textbox,combobox and checkbox with the selected row items of my datagrid.I have used dataservice to populate my datagrid with records from database. So now when i will select any row then the controls mentioned above must show the items which i selected.

Plz suggest how can i achieve it..or a demo will be helpfull
Posted
Updated 13-Jul-12 17:44pm
v2

1 solution

You have a proerty called SelectedItem, this property represent your Row (is your selected object).

So in your TextBox, combobox or another control you can do Something like this, in your xaml.
Let me take the TextBox for the example:
XML
<textbox text="{Binding ElementName=<b>nameofyourDataGrid</b>, Path=SelectedItem.<b>PropertyNameOfYourClass</b>}" />


Hope it helps. =)
 
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